- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 07:48 AM
Hi ,
I need to extract the last four digits of a number field ,irrespective of the identifiers. mean we dont have any option to split on the string like (" , _, -,) etc.just blindly need to extract last four characters of the string.how can we achieve this..
Regards,
Girish .K
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 08:08 AM
Hi Girish
If you are in a client script you can use .slice(-4) to get the last 4 characters of a string. For an example, the below will alert the last 4 characters of the short description field when loading an incident.
function onLoad() {
var desc = g_form.getValue('short_description');
var lastFour = desc.slice(-4);
alert(lastFour);
}
Hope it helps.
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 08:08 AM
Hi Girish
If you are in a client script you can use .slice(-4) to get the last 4 characters of a string. For an example, the below will alert the last 4 characters of the short description field when loading an incident.
function onLoad() {
var desc = g_form.getValue('short_description');
var lastFour = desc.slice(-4);
alert(lastFour);
}
Hope it helps.
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 01:38 AM
Thanks Matt