- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 05:14 AM
Hi,
I want to convert the values entered by the user on the record producer with comma separation so that the values are set.
Is there a way to make it happen?
Regards,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 05:56 AM
Hi @mi2022
Use onChange catalog client script on that single line text variable as below
var input=newValue;
var output = input.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
g_form.clearValue('SingleLineTextVariableName');
g_form.setValue('SingleLineTextVariableName',output);
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 05:16 AM
Hi @mi2022 ,
What types of values end users are entering ?
What will be the criteria for values separation e.g after 2 character/1 character?
Please provide more details in order to understand use case.
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 05:46 AM
Hi,
Thank you.
I want a comma to be set for every three threads, such as 1,234 or 1,234,567.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 05:56 AM
Hi @mi2022
Use onChange catalog client script on that single line text variable as below
var input=newValue;
var output = input.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
g_form.clearValue('SingleLineTextVariableName');
g_form.setValue('SingleLineTextVariableName',output);
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 05:20 AM
Hi @mi2022 ,
Have a look at this post. need a script to push multiple values with comma seperated
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thank You