Help

Select field preloads description field with Template?

Topic Labels: Automations
284 5
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi,

What I want to achieve is this:

In Select field I select one of the available values - e.g. (Tom, Ben, John)

Based on what I selected, it preloads a text template to another field (Description)

E.g. I selected Tom, so it preloads premade text about tom in the description field.

Also I want this field to be editable further if I wish to.

How to do that? Thank you for your help!

5 Replies 5

Hi @Valdemar_T - you can do this with a formula (but you won’t be able to edit it later) - pseudo-code:

IF({SINGLE SELECT} = 'Tom', 'Description for Tom........', IF(.....))

As an alternative you should be able to build this into an automation with a script which populates a text field when the single select is chosen. This method would allow you to edit the description later.

Yes, but I noticed that this automation could theoretically change already existing values e.g. I have a table that already has some instances created, so those would be overwritten if the condition matches?

Also, can I preload those templates from another table, or it must be exactly in the same table?

Could you possible help with a script, how could it look like?

It is under one base.

Table 1 - Single Select Field “Fruit” (Few values e.g. apples, oranges) which triggers action

Table 2 - contains text templates of apples, and oranges

Once, Fuit is selected, Table 1 - Descritpion Field is populated with a value in our case template from Table 2.

Would be highly appreciated!

It seems I have managed to find a solution, so sharing it with others. Though I am using not a dynamic records as so, but simply manually added Record ID of the template I want to trigger.

//Preaload values from a Table with templates
let table1= base.getTable('Table with templates name');
let query = await table_sablonai.selectRecordsAsync();
let record = query.getRecord('recorID'); //Here is a record ID of a template

//These are the values I copy from templates fields
let value1= record.getCellValue('value1');
let value2= record.getCellValue('value2');
let value3= record.getCellValue('value3');


//Table in which templates will appear based on trigger
let table = base.getTable("Table name");

//Gets the triggered value on which it will apply changes
let inputConfig = input.config(); 

//Updates the record
table.updateRecordAsync(`${inputConfig.record_id}`, { field_1: value1})
table.updateRecordAsync(`${inputConfig.record_id}`, { field_2: value2})
table.updateRecordAsync(`${inputConfig.record_id}`, { field_3: value3})

Hope this helps others, if you have tips to how improve the code, let me now

Quicker query to update values.

//Updates the record
table.updateRecordAsync(`${inputConfig.record_id}`, { 
field_1: value1,
field_2: value2,
field_3: value3})