- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 07:42 AM
Hi Community,
I have a script that works perfectly, apart from the fact that our incident Priority is customised as:
1-Critical, 2-High, 3-Medium
Our script is sent to an external party and needs to pull the current Priority but without the number 1 and - in from of the priority.
Example string below, which current priority, (but should obviously remove the above number and dash)
r.setStringParameterNoEscape('Priority', current.priority);
Is there a way to slice the number and dash that i can return in the above string?
Many thanks
Steve
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 09:12 AM
You're missing a bracket and semicolon after the script I provided. );
r.setStringParameterNoEscape('Priority', current.priority.getDisplayValue().match(/([A-Za-z])\w+/)[0]);
If my reply helped with your issue please mark helpful 👍 and correct if your issue is now resolved. ✅
By doing so you help other community members find resolved questions which may relate to an issue they're having.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 07:53 AM
Hi,
you can use a .split() however if you're worried of future development not correctly formatting the text, use the below regex.
r.setStringParameterNoEscape('Priority', current.priority.match(/([A-Za-z])\w+/)[0]);
If my reply helped with your issue please mark helpful 👍 and correct if your issue is now resolved. ✅
By doing so you help other community members find resolved questions which may relate to an issue they're having.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 08:25 AM
Kieran,
Thank you for your response, however when I adjust my business rule accordingly, which has to match the other parameters, this doesn't get proposed adding your suggestion, it doesn't appear in the Outbound HTTP logs at all.
Adjustment:
r.setStringParameterNoEscape('Domain', current.business_service);
r.setStringParameterNoEscape('Description', current.work_notes);
r.setStringParameterNoEscape('DescriptionHTML', current.u_html_description);
r.setStringParameterNoEscape('AttachmentName', 'Attachment');
r.setStringParameterNoEscape('AttachmentContent', 'base64 encoded');
r.setStringParameterNoEscape('AttachmentDescription', '1');
r.setStringParameterNoEscape('SubDomain', current.service_offering);
r.setStringParameterNoEscape('CustomerTicketID', current.number);
r.setStringParameterNoEscape('CustomerContactInformation', current.caller_id);
r.setStringParameterNoEscape('Title', current.short_description);
r.setStringParameterNoEscape('TicketType', current.u_incident_type);
r.setStringParameterNoEscape('Priority', current.priority.match(/([A-Za-z])\w+/)[0]);
Thanks
Steve

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 08:35 AM
Hi Steve,
Might have presumed incorrectly that the values you provided were the choice values and not the display values. If it is the latter you need to specify to get the display value.
current.priority.getDisplayValue().match(/([A-Za-z])\w+/)[0]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 08:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 09:12 AM
You're missing a bracket and semicolon after the script I provided. );
r.setStringParameterNoEscape('Priority', current.priority.getDisplayValue().match(/([A-Za-z])\w+/)[0]);
If my reply helped with your issue please mark helpful 👍 and correct if your issue is now resolved. ✅
By doing so you help other community members find resolved questions which may relate to an issue they're having.