The CreatorCon Call for Content is officially open! Get started here.

Make Value Non-Editable

DEEPAK KUMAR SI
Tera Contributor

Hi Dev's,

I have requirement where in a List collector field on a catalog item default value should be non-editable.

DEEPAKKUMARSI_0-1701681848003.png

*** User will be able to select other values in the field but user should not remove the default value .

2 REPLIES 2

Anil Lande
Kilo Patron

Hi,

You cannot make only specific selection readonly in list collector.

You can use alternate way set the default value even if user remove it.

create onChange client script and use below logic:

 

var defaultValue = 'Your Value Here';  // sys_id of your record

if(newValue.indexOf(defaultValue)<0){

g_form.setValue('variable_name',newValue.toString()+','+defaultValue);

alert('Please do not remove the DefaultValue option');

}

 

You can use same login in onSubmit client script;

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @DEEPAK KUMAR SI 

 

The purpose of default is if user missed the value then system take the default value and save the record. As per my knowledge restricting default value is not a case here. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************