cancel
Showing results for 
Search instead for 
Did you mean: 

In automation chain, RunOperation with condition on a contex variable not working

steeve_gagnon
Champ in-the-making
Champ in-the-making

Hello.

Here the automation chain :

- Repository.GetDocument:
    value: "@{This.get(0).id}"
- Context.SetVar:
    name: nbrWrkFlowCourant
    value: "99"
- javascript.AS_VerifierPublier
- Log:
    level: warn
    message: "@{Context[\"nbrWrkFlowCourant\"]}"
    category: DEBUGSG nbrWrkFlowCourant test 222
- RunOperation:
    id: "@{ Context[\"nbrWrkFlowCourant\"] ==\"1\" ? \"AC-ToWormAuto\" : \"AC-SGTEST\"}"
    isolate: "false"

Operation #3 (javascript.AS_VerifierPublier) put the value "1" in the variable nbrWrkFlowCourant

Operation #4 log in server.log the value "1"

Operation #5 Execute AC-SGTEST not AC-ToWormAuto !!!

If i try id: "@{ \"1\"==\"1\" ? \"AC-ToWormAuto\" : \"AC-SGTEST\"}" IT work

if i try id: "@{ Context[\"nbrWrkFlowCourant\"] ==\"99\" ? \"AC-ToWormAuto\" : \"AC-SGTEST\"}" not working

   if i try id: "@{ Context[\"nbrWrkFlowCourant\"] ==\"\" ? \"AC-ToWormAuto\" : \"AC-SGTEST\"}" not working

I think i fail to get the value but i dont know why.

Please help !!!

TY

Steeve

4 REPLIES 4

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

Could you please explain what you are trying to do in this example, it is not very clear. Then, why not writing all your code in a single automation scripting? That would be far away easier to debug.

Regards

I need a conditional execution of the chain AC-ToWormAuto. If var nbrWrkFlowCourant contain 1 then i sould execute the chain. An alternative will be to execute AC-ToWormAuto from javascript.AS_VerifierPublier but i dont know how.

somewhere else we do conditional execution according to a property and it work so why not a variable "@{Document.parent.name=="zoneTravail" ? "AC-DemarrerReceptionOPR"

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Something like

function run(input, params) {
	var parent = Document.GetParent (input, {});
	var parentName = parent.name;
	if (parentName == "zoneTravail")
		{
			/// Something, or call a function, or call an automation chain
			  RunOperation(
				input, {'id': "Another_Automation_Chain"});
	
		}
	else
		{
			/// SOMETHING ELSE
		}
}

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.