Hi Community,
Any idea how i can override the on click event of workflow bar. Lets say for example on click of 'In progress' i want to add some other logic, then based on that logic system will decide whether to allow user to proceed to 'In progress' or not. What method can I override so that i can put my custom logic ?
Like
Rather than override the click, maybe it would work to just wire up a change event on the property itself? See https://customerfx.com/article/triggering-an-event-when-a-field-is-changed-on-a-page-in-bpmonline/
Something like this:
attributes: { "StageChange": { dependencies: [{ columns: ["Stage"] methodName: "onStageChange" }] } }, //... methods: { onStageChange: function() { // do something here or prompt user // if needed, revert back to previous value } },
If you need to revert back to the previous value, what I would do is store the current Stage value in an attribute in the onEntityInitialized. Then you can use that to revert back if needed (and update the attribute if you do allow the change).
The only thing that could cause issues with this approach is if there are processes or case steps that would have already fired before you revert the change. Anyway just an idea.
I didn't spend too much time looking at the Dcm mixin to override the logic there, but this approach would be easier so thought I would suggest it. Hope this helps.
Ryan
Click event of a workflow bar causes saving of a page. Before saving the page a validation happens. Please feel free to override the method asyncValidate to add a required functionality. For example:
define("LeadPageV2", [],
function() {
return {
entitySchemaName: "Lead",
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
attributes: {},
methods: {
asyncValidate: function(callback, scope){
this.callParent([function(resultObject){
resultObject.success = false;
resultObject.message = "Your message!";
callback.call(scope, resultObject);
}], scope);
}
},
diff: /**SCHEMA_DIFF*/[
]/**SCHEMA_DIFF*/,
rules: {},
userCode: {}
};
});