Help

Updating with new options in Single Select via automation script

Topic Labels: Automations
Solved
Jump to Solution
75 1
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi,
I created a script which takes data  in a project financial table and updates special table with payments report.
I'm going to setup it to run daily or weekly automation, and add it to many projects in different bases.
Problem with updating a single-select field 'Type' (of operation), when new Types appear.
here is the issue, automation can't do that (script extension works ok):

Alexey_Gusev_0-1726243034720.png

thinking about workaround - use preparation script, compare and check whether new types available, 
output them in variable 'newtypes', find any random record in destination, loop Update it's 'Type' through the list of 'newtypes', then return the old value.
Then run main script.

More clean solution, to avoid affecting Modified Date of existing record could be - Create new record, Loop update it with all new types, then delete it (by script).

Unfortunately, Loop must be in the end. Can't return old value, can't run main script
(I put 'List of record IDs' in 'Record ID'(to update), it's not quite correct, but since I set maximum of Find Records to 1, it should work)

Alexey_Gusev_1-1726246369494.png

Now I think it can be done with 2 automations. one checks and updates new Types,
second, running 2-5 minutes after first - execute main script

not a good solution, but others are even worse.
Does anybody have better ideas - how to solve Single-Select new options problem when using automation script?



1 Solution

Accepted Solutions
Alexey_Gusev
12 - Earth
12 - Earth

For those who might be interested, solution I crafted for this case.
(it's also a simple example how to use webhook automation)
I created special procedure launched by webhook. Parameters passed: addtypes - array of new options,
anyID -  ID of any record , oldval - value of this record 'TYPE' column
In loop, it updates the record with new option, then returns old value. in the end, record remains unchanged and the field settings updated with all new options.

Alexey_Gusev_2-1726311134905.png

In code, I call this webhook with input parameters and waiting until last option added, then do the rest of script. The operation consume 5-15 seconds, so when I have to add many new updates, there's a risk whole automation doesn't fit in 30 sec, but in my case it's acceptable. Once options added, and a part of new updates, when automation runs next day, it will add the rest.

 

Alexey_Gusev_1-1726310609680.png

 

 

See Solution in Thread

1 Reply 1
Alexey_Gusev
12 - Earth
12 - Earth

For those who might be interested, solution I crafted for this case.
(it's also a simple example how to use webhook automation)
I created special procedure launched by webhook. Parameters passed: addtypes - array of new options,
anyID -  ID of any record , oldval - value of this record 'TYPE' column
In loop, it updates the record with new option, then returns old value. in the end, record remains unchanged and the field settings updated with all new options.

Alexey_Gusev_2-1726311134905.png

In code, I call this webhook with input parameters and waiting until last option added, then do the rest of script. The operation consume 5-15 seconds, so when I have to add many new updates, there's a risk whole automation doesn't fit in 30 sec, but in my case it's acceptable. Once options added, and a part of new updates, when automation runs next day, it will add the rest.

 

Alexey_Gusev_1-1726310609680.png