I am trying to run a section of code shared by Dan from here: Pastie
The code works great to do several procedures and eventually fire off some automations when field Id 45 is filled in. The problem is that the automations end up all running at once; I need them to run sequentially. I tried inserting the underlined timeout lines to put a lag between filling in each record. The lag works, but then the records aren't filled in correctly; it seems to not be retrieving the record information properly. Any thoughts?
I am also open to other ideas to run automations with a lag! Code is below:
$("record", xml2).each(async function(index) {setTimeout(async function() { ////Timeout functionvar record = $("record_number", this).text();var now = $("now", this).text();var xml3 =await Promise.resolve($.get(dbid1, {act: "API_EditRecord",rid: record,_fid_45: now,}));console.log(index);console.dirxml(xml3);}, count * 1000) ///Timeout functioncount++; ///timeout function});}------------------------------
Jessica Jessica
------------------------------