Native Pulsar UI Interaction API
- 1 Native Pulsar UI Interaction
- 1.1 setLeavePageMessage
- 1.2 exit
- 1.3 showCreate
- 1.4 viewObject
- 1.5 viewRelated
- 1.6 viewList
- 1.7 lookupObject
- 1.8 scanBarcode
- 1.9 executeQuickAction
- 1.10 cameraPhoto
- 1.11 cameraPhotoPicker
- 1.12 filePicker
- 1.13 displayUrl
Native Pulsar UI Interaction
The calls that support Pulsar native screen interaction need to know that you will only see the response when the native screen is dismissed by the user. For example, if your code calls viewObject
in edit mode, when the user types the data on the screen and hits save or cancel, you will see the JSAPI response. This way, you can take the appropriate action based on that response.
setLeavePageMessage
The setLeavePageMessage
API allows you to display a confirmation prompt whenever the user tries to leave the page. If a message is specified, the user will be prompted to select 'Yes' or 'No' for the Done button press as well as for these web navigation buttons: Refresh, Back, Forward. To disable this prompt, call this command again with a zero length string.
var request = {
"type" : "setLeavePageMessage",
"object" : "",
"data" : "Are you sure you want to leave this page?" // message displayed in a yes/no confirmation alert
};
bridge.sendRequest(request, function (responseData) { alert('Javascript got its view response: ' + responseData); });
exit
The exit
API closes the html document. This command is the same as pressing the Done button and will work alongside the setLeavePageMessage command.
var request = {
"type" : "exit",
"data" : {}
};
bridge.sendRequest(request, function (responseData) { console.log('exit: ' + responseData); });
showCreate
var request = {
"type" : "showCreate",
"object" : "Account",
"data" : { "Name" : "John Doe Industries", "Phone" : "867-5309" }
};
bridge.sendRequest(request, function(responseData) {
if (responseData.type === "showcreateResponse"
&& responseData.data.createResult === "TRUE") {
alert('Create Success! ObjectId: ' + responseData.data.createId);
} else {
alert('Error during create: ' + responseData.data);
}
});
viewObject
viewRelated
viewList
lookupObject
scanBarcode
executeQuickAction
cameraPhoto
cameraPhotoPicker
filePicker
displayUrl