is it possible to iteratively run an action sequence within a javascript snippet?

  • 1
  • Question
  • Updated 2 months ago
  • In Progress
I've got a nice action sequence that transforms data from my table's row in context and passes it into a newly created row on another object. It works great as a row action on my table.

However, I need to call and run this sequence iteratively over hundreds of rows in the table. 

Is that possible?
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 3,280 Points 3k badge 2x thumb

Posted 2 months ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Hi Conlan. It sounds like your action sequence is more complicated than simply adopting the selected rows from one model into another, right? If not, you can use the adopt row action. 
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 3,280 Points 3k badge 2x thumb
Hi Mark,

With adopt rows, is there any way to pass values from one field to another. For example, if I have a data value in a field called "Monitor Date 1" on Tax_Abatement__c (source) object and I need to pass the date value to another field called "Performance Review Date" on Requirement__c (target) object, can I do that?

I created a sequence using a bunch of activate and set condition actions on my target model/object, so I was hoping there might be an easy/fast way to simple call that sequence for each row in the source.

Perhaps it's just faster to convert the whole sequence to javascript though...?

Thanks,

Conlan
Photo of Matt Davis

Matt Davis, Employee

  • 654 Points 500 badge 2x thumb
One option that could work is to do it all with actions on a UI only field in the Tax_Abatement model.

The general logic is something like this...
  • Create a UI-Only checkbox on Tax_Abatement
  • Create an action 'whenever field UI_Check is updated'
  • In that action, have it create a new row in Requirement__c defaulting the values accordingly (I think default will work, if not you'll need to do the activate & set actions you're currently doing
  • Now you can create a button/global action that updates field in a row(s), and have it check the UI_Check for all rows in model Tax_Abatement (if needs to run multiple times, add a branch that says if checked then uncheck, if unchecked then check)
The advantage to this is that if you have 100 rows, it'll run that set of actions once per row and it'll keep that row's context. It may take some fine tuning to get it to work as expected, but I think something along those lines should help you get there. We did something similar for creating a tasks for each row selected in a table showing a list of opportunities, and this was our approach.
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 3,280 Points 3k badge 2x thumb
Matt, thanks for the suggestion. I gave this a shot, and came very close to being able to use this. However, using activate and set conditions did not work in this case. It appears the conditions are not being set for each row's context, but instead setting to the values from the last row in the table. When I tried using default values in the Create New Row action, that approach did maintain the context of each row...however, I ca not pass in date values from my context row...since the content of a default date field can only accept either a relative value (e.g. yesterday) or a specific date (e.g. 9/18/2018). I can't pass in a content value from another field (e.g. {{Required_Date__c}}) See previous post here.