BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only

BPM: Initialize options variable on Coach views without a variable associated 

Fri July 24, 2020 11:05 AM

Hello,   I'm creating a coachview where I need to declare some options variables but just for internal use of the coach view... The developer that will use the coach view doesn't need to create a variable on it's service just to bind it to the coach view. The problem is that if the developers that's using the coach view doesn't pass a variable, it will be null and some methods will not work....

#Featured-area-3
#Featured-area-2-home
#Featured-area-2
#Business Process Manager

Statistics
0 Favorited
444 Views
0 Files
0 Shares
0 Downloads

Comments

Mon February 05, 2024 11:19 AM

You can use substituteConfigOption in the load event to initalize your variables. 

In below example I intialized faNumber

// LOAD EVENT ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
try {
    var view = this;
    var opts = this.context.options;
    var mdt = opts._metadata;
    
    if (!this.context.binding) {
        this.context.binding = bpmext.ui.substituteObject(this);
    }
    
    // Intiialize Set Defaults incase below variables are not set from coach

    if (!opts.faNumber) {
        bpmext.ui.substituteConfigOption(this, "faNumber", "");
    }
   
    
    
    bpmext.ui.loadContainer(this);
} catch (e) {
    //{#feature: US-1330 Added RT localization}
    //bpmext.log.error("Error on load event [" + this.context.viewid + "]: " + e);
    bpmext.log.error(bpmext.localization.formatMsg("general", "ERROR_ONLOAD_EVENT") + " [" + this.context.viewid + "]: " + e);
    if (e.stack) {
        //{#feature: US-1330 Added RT localization}
        //bpmext.log.error("  Call stack: " + e.stack);
        bpmext.log.error("  " + bpmext.localization.formatMsg("general", "CALL_STACK", e.stack));
    }
}