VMware Cloud Community
michalpawlak
Enthusiast
Enthusiast
Jump to solution

Criteria for workflow subscription via vRealize orchestrator

Hi all,

I have been trying to get workflow "Register a system workflow subscription" to work. Subscription seems to work fine, but i cannot come up with syntax for criteria part, could some of you share that information. What should be defined there if i would like to get trigger it at state:

phase: PRE

state: VMPSMasterWorkflow32.Requested

 

   payload>lifecycleState> phase : PRE
   payload>lifecycleState> state : VMPSMasterWorkflow32.Requested

//M

Reply
0 Kudos
1 Solution

Accepted Solutions
befreeman
Enthusiast
Enthusiast
Jump to solution

Sure, no prob.  Here is the scriptable code I am using to create the subscription criteria for machine type = VM, machine provisioning, and POST phase:

var provisioningCriteriaObj = {

  "type" : "and",

  "subClauses" : [ {

    "type" : "expression",

    "operator" : {

      "type" : "equals"

    },

    "leftOperand" : {

      "type" : "path",

      "path" : "data~machine~type"

    },

    "rightOperand" : {

      "type" : "constant",

      "value" : {

        "type" : "integer",

        "value" : 0

      }

    }

  }, {

    "type" : "expression",

    "operator" : {

      "type" : "equals"

    },

    "leftOperand" : {

      "type" : "path",

      "path" : "data~lifecycleState~state"

    },

    "rightOperand" : {

      "type" : "constant",

      "value" : {

        "type" : "string",

        "value" : "VMPSMasterWorkflow32.MachineProvisioned"

      }

    }

  }, {

    "type" : "expression",

    "operator" : {

      "type" : "equals"

    },

    "leftOperand" : {

      "type" : "path",

      "path" : "data~lifecycleState~phase"

    },

    "rightOperand" : {

      "type" : "constant",

      "value" : {

        "type" : "string",

        "value" : "POST"

      }

    }

  } ]

};

provisioningCriteria = JSON.stringify(provisioningCriteriaObj);

View solution in original post

Reply
0 Kudos
6 Replies
harkamal
Expert
Expert
Jump to solution

Does this help ?

1.png

Reply
0 Kudos
michalpawlak
Enthusiast
Enthusiast
Jump to solution

Thanks harkamal  but  my idea is a bit different, i would like to do it via Orchestrator, not frontend.

2016-04-13 16-04-19_VMware vRealize Orchestrator.png

Reply
0 Kudos
befreeman
Enthusiast
Enthusiast
Jump to solution

Hi,

I answered this here: Question regarding vRA7 Register a System Workflow Subscription

Hopefully that helps.

Reply
0 Kudos
michalpawlak
Enthusiast
Enthusiast
Jump to solution

Hi befreeman ,

Could you be so kind and publish what you have received from:

var criteria = vCACCAFEEBSHelper.getCriteriaFromWorkflowSubscription(workflowSubscription);

System.log(criteria);

 

because I am a bit suspicious of what i got from my query.

Reply
0 Kudos
befreeman
Enthusiast
Enthusiast
Jump to solution

Sure, no prob.  Here is the scriptable code I am using to create the subscription criteria for machine type = VM, machine provisioning, and POST phase:

var provisioningCriteriaObj = {

  "type" : "and",

  "subClauses" : [ {

    "type" : "expression",

    "operator" : {

      "type" : "equals"

    },

    "leftOperand" : {

      "type" : "path",

      "path" : "data~machine~type"

    },

    "rightOperand" : {

      "type" : "constant",

      "value" : {

        "type" : "integer",

        "value" : 0

      }

    }

  }, {

    "type" : "expression",

    "operator" : {

      "type" : "equals"

    },

    "leftOperand" : {

      "type" : "path",

      "path" : "data~lifecycleState~state"

    },

    "rightOperand" : {

      "type" : "constant",

      "value" : {

        "type" : "string",

        "value" : "VMPSMasterWorkflow32.MachineProvisioned"

      }

    }

  }, {

    "type" : "expression",

    "operator" : {

      "type" : "equals"

    },

    "leftOperand" : {

      "type" : "path",

      "path" : "data~lifecycleState~phase"

    },

    "rightOperand" : {

      "type" : "constant",

      "value" : {

        "type" : "string",

        "value" : "POST"

      }

    }

  } ]

};

provisioningCriteria = JSON.stringify(provisioningCriteriaObj);

Reply
0 Kudos
michalpawlak
Enthusiast
Enthusiast
Jump to solution

Thx, it is what I need!:)
Reply
0 Kudos