Programmatically Starting a Process from Client Code in bpm’online

There are a lot of ways that a process can get started, or triggered in bpm’online. Signals on entity events, messages, timers, and manually starting a process. You can also start a process from code. You can even provide values for parameters in the process to set context if needed. This article will look at how to start a process from client-side javascript code.

To do this, we’ll need to add MaskHelper to our AMD modules list of our code. What this means is, in the page code you’re calling this from, you’ll add something like this:

define("AccountPageV2", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
    return {
        entitySchemaName: "Account",

        // ... all the rest of the stuff

    };
});

Note the part at the top, you’ll see “ProcessModuleUtilities” (in quotes) in the square brackets and ProcessModuleUtilities (not in quotes) in the function parameters. Looking at require.js or other searches for AMD modules will show you more info on this topic, but basically it is a way for a module to be provided to your code for you to use.

Now that you’ve added that, it’s easy to use.

var contact = this.get("PrimaryContact");
var config = {
    sysProcessName: "UsrMyCustomProcess",
    parameters: { 
        ProcessSchemaContactParameter: contact.value 
    }
};
ProcessModuleUtilities.executeProcess(config);

That’s it. The process will be started and you’ve passed a contact parameter for it to use as well. Note, the “parameters” part is only necessary if you need to set a process parameter to provide context.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!