confirm on an business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2016 11:44 PM
Hi All,
I have a requirement, on changing status to closed. User should get a popup for attachment. If he will click ok then ticket will save otherwise ticket should not close. For this I wrote a client script on submit:
function onSubmit() {
var state = g_form.getValue('u_state');
var r;
if (state=='Closed'){
r = confirm('Have the final signed documents been attached?');
if (r == true) {
return true;
} else {
return false;
}
}
}
But if I am using this script , it will run whenever state will be 'Closed'.
or how I can get this confirm window in business rule?
Kindly suggest how could I achieve this .
Thanks
Nikita
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2016 11:58 PM
Hi Nikita,
As far as I understood from you requirement is that user should not be able to close the ticket if there is no attachment. Correct me if I am wrong.
If that is the case then you can use before update business rule which should run only if state changes to 'Closed'. And in the script use 'hasAttachments()' method to check if the current record has any attachments.
If this method returns false then abort the action using 'setAbortAction(true)' & use gs.addInfoMessage/gs.addErrorMessage to display the message. You can not use 'confirm' in server side scripting.
Thanks,
Abhinandan