Projects:Pick & Execute process extension/Technical Specification
Pick & Execute process extension - Technical Specifications
Client-side technology
The mechanism to set/define and call/execute the actions is OB.Utilities.Action. All the information about how it works can be found here
Backend usage
As you already maybe know, at the end of a Pick & Execute process, a JSON is returned in the doExecute method. More info here
Saying that, the only thing needed to execute actions when a Pick & Execute process is done, is add a new item "responseActions" in the returned JSON object.
This "responseActions" is the object (or the array of objects) that is going to be executed automatically (if it exists in the response) by using "OB.Utilities.Action.executeJSON" in the client-side.
Code example to add inside the doExecute method (being "request" the returned JSON)
JSONArray responseActions = new JSONArray(); JSONObject action1 = new JSONObject(); JSONObject action1Params = new JSONObject(); action1Params.put("msgType", "info"); action1Params.put("msgTitle", OBMessageUtils.messageBD("Info")); action1Params.put("msgText", "Open a 'Sales Order' -> 'Lines' record"); action1.put("showMsgInView", action1Params); responseActions.put(action1); JSONObject action2 = new JSONObject(); JSONObject action2Params = new JSONObject(); action2Params.put("tabId", "187"); action2Params.put("recordId", "029FD997C4E14F9E98FBA8549D5884A6"); action2Params.put("wait", "true"); action2.put("openDirectTab", action2Params); responseActions.put(action2); JSONObject action3 = new JSONObject(); JSONObject action3Params = new JSONObject(); action3Params.put("msgType", "success"); action3Params.put("msgTitle", OBMessageUtils.messageBD("Success")); action3Params.put("msgText", "Window opened successfully"); action3.put("showMsgInView", action3Params); responseActions.put(action3); request.put("responseActions", responseActions);
This code generates the following json array:
request.responseActions = [ { "showMsgInView": { "msgType": "info", "msgTitle": "Info", "msgText": "Open a 'Sales Order' -> 'Lines' record" } },{ "openDirectTab": { "tabId": "187", "recordId": "029FD997C4E14F9E98FBA8549D5884A6", "wait": "true" } },{ "showMsgInView": { "msgType": "success", "msgTitle": "Success", "msgText": "Window opened successfully" } } ]
that will be passed directly to "OB.Utilities.Action.executeJSON"
The action sequence for this particular example is: 1. Show an "Info" message bar in the window where the process have been executed with text "Open a 'Sales Order' -> 'Lines' record"
2. Open the tab with id "187" in the record "029FD997C4E14F9E98FBA8549D5884A6" (and wait until the tab is completly opened)
3. Show a "Success" message bar in this recently opened window with text "Window opened successfully"