- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 01:06 AM
We have loads of email release incident tickets come into us from shared mailboxes which then get logged under the Guest caller. A lot of these tickets are getting closed under Guest which from a reporting point of view is not good. Would anyone have any idea for code for a client script to prevent incident records being set to resolved if the Caller field is still Guest? This is what I have so far 5136503cc611227c0183e96598c4f706 is the sys ID for our Guest account
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var caller_name = g_form.getValue(‘caller_id’);
if(caller_name == ‘5136503cc611227c0183e96598c4f706’){
g_form.setValue(‘state’, ” ”);
g_form.addInfoMessage(“An incident can not be resolved while Caller is set to Guest. Please get the original requestor's name”);
//}
//}
//Type appropriate comment here, and begin script below
}
Solved! Go to Solution.
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 01:43 AM
Hi @lynchr02,
Whilst a Client Script or UI Policy will certainly help with the User Experience (UX), it's best to trap this at the server layer.
You may also want to consider not just Resolution, but also closure. See the below Business Rule to implement to take care of this for you.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
(function executeRule(current, previous /*null when async*/ ) {
gs.addInfoMessage("An incident can not be resolved while Caller is set to Guest. Please get the original requestor's name");
current.setAbortAction(true);
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:50 AM
Great - No worries at all @lynchr02. Happy Thursday ; )
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 01:17 AM
Hi @lynchr02,
You can use write ACL for this too.
However if you want to restrict it for Guest without ACL, I suggest you use UI Policy and make the fields read only for Guest. U can use scripting there and check if logged in user is Guest and then the UI Policy would apply. This would be applicable if you want to restrict Guest from editing many fields.
If only few fields should be made read only then make he following changes:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var caller_name = g_form.getValue(‘caller_id’);
if(caller_name == ‘5136503cc611227c0183e96598c4f706’){
g_form.setReadOnly(‘state’, false);
g_form.addInfoMessage(“An incident can not be resolved while Caller is set to Guest. Please get the original requestor's name”);
//}
//}
//Type appropriate comment here, and begin script below
}
If you found my reply useful, please mark it as Solution and Helpful.
Thanks and Regards,
Ehab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 01:23 AM
Hi @lynchr02
You can create a before update business rule like this-
(function executeRule(current, previous /*null when async*/) {
var guestSysId = '5136503cc611227c0183e96598c4f706';
if (current.caller_id == guestSysId) {
gs.addErrorMessage('Guest tickets cannot be resolved.');
current.setAbortAction(true);
}
})(current, previous);
Please mark my answer helpful and correct.
Regards.
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 01:43 AM
Hi @lynchr02,
Whilst a Client Script or UI Policy will certainly help with the User Experience (UX), it's best to trap this at the server layer.
You may also want to consider not just Resolution, but also closure. See the below Business Rule to implement to take care of this for you.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
(function executeRule(current, previous /*null when async*/ ) {
gs.addInfoMessage("An incident can not be resolved while Caller is set to Guest. Please get the original requestor's name");
current.setAbortAction(true);
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 01:58 AM
Thanks Robbie for some reason when I go into Business Rules and create a new one when the page renders the condition options disappear as well as the Advanced tab so I can't enter the script code you provided. It happens in both Chrome and Edge any ideas?