Skip to content

Instantly share code, notes, and snippets.

@joebordes
Created May 16, 2020 18:04
Show Gist options
  • Save joebordes/a32124e77fdf715b186a643d84d66288 to your computer and use it in GitHub Desktop.
Save joebordes/a32124e77fdf715b186a643d84d66288 to your computer and use it in GitHub Desktop.
call Business Action from javascript
getGraph = () => {
mermaid.initialize({ startOnLoad: true, securityLevel: 'loose', });
cbconn.doLogin('admin', 'admin', true)
.then(()=> {
//cbconn.doInvoke('executeBusinessAction', { businessactionid: '47086', 'context':JSON.stringify({'ID':'13x47084', 'MODE':''}) }, 'GET')
//cbconn.doInvoke('executeBusinessAction', { businessactionid: '47087', 'context':JSON.stringify({'ID':'13x47084', 'MODE':''}) }, 'GET')
cbconn.doInvoke('PushAlongFlow', { pflowid: '47069', 'contextid': '13x47089'}, 'GET')
.then(data => {
// let graph = data.substr(data.indexOf('graph'));
// graph = graph.substr(0, graph.indexOf('</div>'));
this.renderGraph(data.graph);
var self = this;
window[data.functionname] = function (tostate, forrecord, askifsure) {
let element = {
'id': data.record
};
element[data.fieldname] = tostate;
cbconn.doRevise(data.module, element).then((data) => self.getGraph());
return false;
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment