Running or calling a workflow from JavaScript

I think the title says it all. How I can I call a workflow action from a plug-in

do you mean like your plugin gives the green light for a workflow of other actions? or your plugin gives the green light to a workflow of its own action?.. lol does that make sense?

name it here

so say “is_green_light”

then maybe in your code,

var status = properties.whenReady;
if (status != "ready") {
 instance.publishState("ready", false); //can trigger a workflow using if condition is true and do nothing in the plugin
}else{
instance.triggerEvent("is_green_light", function() {
  return alert("Go!"); //trigger a workflow and an alert in the plugin
});
};

something like that what you mean?

2 Likes

Well what I basically mean is for example. If the plug-in element is clicked then excute next page on repeating group.

Or excute a custom function to do something else

for the function inside the plugin:

var div;
    div = $('<div id="myElement"></div>');
    div.css("width", "100%");
    div.css("height", "100%");
    instance.canvas.append(div);

    $( "#myElement" ).click(function() {
      alert( "I got clicked" );
    });

for the repeating group:

var div;
div = $(‘Next’);
div.css(“width”, “100%”);
div.css(“height”, “100%”);
instance.canvas.append(div);

    $( "#myElement" ).click(function() {
     instance.triggerEvent("is finger punched");
   });