hide comma separated string value on field on incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2023 03:33 AM
Hi, I have two comma separated values in one field on incident form. and I want to hide other value on condition based.
Is it possible to hide it??
I have field correlation id on incident form. there are 2 comma separated values of string and I want to hide second string which is the sysid of one table on condition based.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 04:12 AM
@Ankur Bawiskar Do you have any comments on this requirement.
Thanks in advance!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 05:07 AM
yes this is possible.
you can use onChange client script on the field on which you want to show/hide
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var val = g_form.getValue('correlation_id');
if (newValue == "Your Value") {
var arr = val.split(',');
var firstPart = arr[0];
var secondPart = arr[1];
var maskedString = '********************************'; // I used 32 times since it's a sysId
var finalStr = firstPart + maskedString;
g_form.setValue('correlation_id', finalStr);
}
else{
g_form.setValue('correlation_id', val);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader