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

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

0 votes

2 answers

808 views

ANSWER



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
        }
}
1 votes



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

0 votes



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.
10/01/2020

somewhere else we do conditional execution according to a property and it work so why not a variable "@{Document.parent.name==\"zoneTravail\" ? \"AC-DemarrerReceptionOPR\":\"AC-NULLOperation\"}"
10/01/2020