Sep 13, 2024 10:51 AM
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):
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)
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?
Solved! Go to Solution.
Sep 14, 2024 03:58 AM
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.
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.
Sep 14, 2024 03:58 AM
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.
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.