hide comma separated string value on field on incident form

fgh1
Tera Contributor

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??

fgh1_0-1703071605145.png

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.

 

11 REPLIES 11

@Ankur Bawiskar Do you have any comments on this requirement.

Thanks in advance!!

@fgh1 

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.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader