Introduction:
Commands in Resco mobile app allow certain actions throughout the whole form. The main principle is to create a command in Woodford, but the logic that need to be performed on execute of the command can be defined in the JavaScript.
Let’s consider an example, on “Work Order” user wants a custom command to “Close – Posted” the work order from Resco App.
Below will be the steps in order to add custom command for Close Posting the work order:
1. Open “Resco woodford” application. Navigate to “Work Order” entity’s Edit Form and click on “Edit”.
2. Click on “New Command” and mention name of the command.
3. Command is created, so in order to bind the action that need to performed using JavaScript or also by using OnExecute button in Woodford. Here we will try using both JavaScript as well as OnExecute. Next step will be adding Html with script on “Work Order” form.
4. Upload the HTML and JavaScript in the offline Html section in Woodford by clicking on the “Upload” button as shown in the below screenshot.
5. Click on Add IFrame >> Browse to select the html to be added on the form. Refer the below screenshot for the same.
6. Select the HTML page having javascript code to save and close the current record.
<!DOCTYPE html>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title></title>
<meta charset=”utf-8″ />
<meta http-equiv=”X-UA-Compatible” content=”IE=edge” />
<meta name=”viewport” content=”initial-scale=1, user-scalable=no” />
<script src=”Scripts/JSBridge.js”></script>
<script type=”text/javascript”>
function onLoad() {
var functionName = “FnLoad”;
try {
MobileCRM.UI.EntityForm.onCommand(“custom_ClosePostWorkOrder”,
function (entityForm) {
if (entityForm)
MobileCRM.UI.EntityForm.saveAndClose();
}
);
}
catch (e) {
throw new MobileCrmException(functionName + e.message);
}
}
</script>
</head>
<body onload=”onLoad();”>
</body>
</html>
7. Now, on “Work Order” entity’s Edit form, click on Edit. Click on “OnExecute” and add step to change the “System Status” of Work order as “Close Posted”.
8. Save and Publish the Woodford solution.
9. In Resco app, open “Work Order” record. Click on “Close Post Work Order”. This will change the “System Status” to “Close- Posted”, also save and close the “work order” record.
Conclusion:
Using the simple steps given above user can easily create Custom Commands in Resco Mobile App.
Read our blog series on Resco Mobile CRM