Mar 16, 2023 04:04 AM
I have a table with a field called "plact_is_main_activity"
Only one record for all the records sharing the same "_plact_asset_" can be "plact_is_main_activity"=TRUE
So I have set an automation triggered when "plact_is_main_activity" is updated.
When triggered, I need the automation to search which is the record:
and for that record, make "plact_is_main_activity"=FALSE
This is, I need a switcher between records sharing the same asset in such a way that only one can be "plact_is_main_activity"=TRUE.
In the attached image, if record #2 was turned into the main activity by ticking on "plact_is_main_activity", the automation would need to untick "plact_is_main_activity" for record #1 rather than leaving both ticked.
I have not managed to do it with an automation that updates records when triggered, so I would appreciate any tips on how this could be done either by triggering a script or in any other possible way.
Thanks,
Solved! Go to Solution.
Mar 16, 2023 10:31 AM
Instead of using a "when updated" trigger, use a "when record meets conditions" trigger based on when the checkbox is selected.
Then perform a "find records" action to search for the previous record that was checked using the three conditions that you indicated.
Then have a condition based on whether or not the "find records" action identified a record, and have an "update record" action to clear the checkbox of the found record.
Note that the "update record" action can only use the results of the "find records" action if exactly one record was found. However, in this case, only one record should be found, so you should be fine.
Mar 16, 2023 10:31 AM
Instead of using a "when updated" trigger, use a "when record meets conditions" trigger based on when the checkbox is selected.
Then perform a "find records" action to search for the previous record that was checked using the three conditions that you indicated.
Then have a condition based on whether or not the "find records" action identified a record, and have an "update record" action to clear the checkbox of the found record.
Note that the "update record" action can only use the results of the "find records" action if exactly one record was found. However, in this case, only one record should be found, so you should be fine.
Mar 16, 2023 04:05 PM
@kuovonne it works! thank you so much!