Loop Automation Command Action

Right now we have ordinary way to do the loop in automation command except use a hack/workaround that I suggested on forum a while ago (call Sukasem’s Loop by @pauln). It is basically dynamic automation command name trick.

It would be nice if we have this build-in action like another validation for when should loop stop. So, we can do crazier things :wink:

Here one way to do it (another way call script in Command Name):

For example to loop 1 to 20,

Automation Command Name: Loop Automation

  • Update Program Setting Action: Name=curLoop, Value=1, Update Type=Increase
  • Update Program Setting Action: Name=LoopCommand, Value= [='{curLoop}' == '20' ? 'EndLoop' : 'LoopCommand'], Update Type=Update
  • What ever you want to do here. You can even call another automation command.
  • Execute Automation Command: Name= {:LoopCommand}

Automation Command Name: EndLoop

  • Update Program Setting Action: Name=curLoop, Value=0 or empty, Update Type=Update
1 Like

Ah Yes and what a beautify thing it is :grin: -1,000 iterations to create Transaction Documents…
It would be “Do ACM while THIS [:Value] is TRUE” umm.

I don’t think I’m fully getting it probably because I didn’t used this loop on somewhere else however even I constantly optimize it to make work faster every stuff we add to automation makes it a tiny bit slower. As we already have JScript access and we can also trigger automation commands from JScript wouldn’t it be a better idea to use JScript for clause to create that kind of loops? I’m sure it will work really faster than updating settings / resolving printing tags, etc.

Besides that I might be missing something amazing because I’m not aware of the benefit it creates. If it is the case please let me know so I can study your case in more detail.

3 Likes

Ummin my case @emre I needed to create Account Transaction Documents to which there is no API? Therefore to LOOP in and Out of an ACM and read a file Line x Line was the only answer.
(Hint: TransactionLineCount = pointer of where to read the next text line from file)

MY Case:

Let me know if you need to see the script but don’t think it is relevant. I also did ask for some more API development in this area.

1 Like

Maybe I missing something, Can JS call automation command or action now? Never explore JS side quite a while.

It would be better for sure if we can call Action / Automation via script.

Yes cmd.Execute('name:value'); should trigger automation command called name with value command parameter.

I’m not sure if I’ve mentioned it before or not… Sorry :wink:

3 Likes

Ah, that is better then. I obviously missing something.

1 Like

We can also call GQL API queries via embedded JS so we’ll have more options by .61 release.

So we can only pass 1 value which equates [:CommandValue] ? Ok so I would still use Data.Set/Get for multiple values correct?

PS: @emre I truly love the ability to create parameters such as the “Deliverer Tutorial” i.e. AccountDocumentToUse="Some Name" and then reference it in ACM as [:AccountDocumentToUse] - that is fantastic (more please when creating new stuff…).

Wouldn’t it be better to try it first and request a feature if it does not exists?

Well it is 5:40 AM here. Maybe you didn’t requested something lol… I’m going to sleep but I have this in my copy paste cache so I’m posting it here not to loose it. I hope I’ll remember what to do with that.

https://www.git-tower.com/blog/content/posts/54-git-cheat-sheet/git-cheat-sheet-large01.png

1 Like

Was that directed at me? Sorry I do not know what you are referring to as “it” - If it was multiple parameters such in Search Entity Screen I am doing that?

Ah “sleep” it is overrated! (That’s what I tell my wife…)

Hmm… a lot of things still need to execute via Automation Command Rule. I was hoping we just have one Execute script command in the rule and run everything in script, I guess not. Have to think about it more.

Wouldn’t it be cleaner if we have this Loop Automation then? Using dynamic ACM name, it is not problem for veteran here. I thought it would be easier average users to accomplish the task easier with this action. I think using script still need more expertise especially, passing data between automation and script.

I am thinking like average users point of view when they want to execute something they create rule and then add actions step by step then wait how can I loop this/how can I stop this. If there is this Loop action they don’t even have to touch script.

Well I was trying so hard to stay at this level but was drawn into the “Dark Side” by the force (picture @Jesse as Darth Vader…)

I just had another look at my Script and creating Multiple parameters using Data.Set() will do the trick so I could bypass your loop :cry: and stay in the script calling the ACM. For now no need to change a pretty good thing as it works.

1 Like

Still a lot of secret in the Dark side and now we gonna have black hole (GraphQL) for endless hidden secret lol

That’s why I mentioned it here. Having more GraphQL functions will improve possibilities.

I have not seen this before. Added to the Helper doc. Are there more?

2 Likes

I can see this being very useful :slight_smile:

How to use it? I got

I create Rule for Automation Command

And run this script

function test() {
cmd.Execute(‘Automation Show Message:Test’);
}

2 Likes

Any suggestion on this cmd.Execute('name:value'); @emre

Hey @sukasem

Lodge an issue, I think you can split your post off from the error message. I am very keen to see the answer as well.
I would maybe change your Rule Name first just in case it is a reserved word…