Imp Interview Question

tushar_ghadage
Tera Contributor

Hi ,

below scenario was asked in interview -

there is field which is mandatory in dictionary level ..

and you have to make it hidden ..using UI policy 

how to do it..? 

 

My usual Ans was 

first to make Un mandatory and then we can hide it using client script , seems he was not convinced..

is this correct answer..? 

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@tushar_ghadage 

your approach is correct.

1st make it non-mandatory and then hide

you can use onLoad client script or onLoad ui policy for this

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

Sarthak Kashyap
Kilo Sage

Hi @tushar_ghadage ,

 

I tried your problem I think we have to create a client script which runs onLoad and from the script we have to make it mandatory false and display also false.

function onLoad() {
    // var annotations = getAnnotations();

	g_form.setMandatory('description', false);
	g_form.setDisplay("description", false);
}

 

 

SarthakKashyap_0-1761719934052.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

 

 

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@tushar_ghadage 

your approach is correct.

1st make it non-mandatory and then hide

you can use onLoad client script or onLoad ui policy for this

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Sarthak Kashyap
Kilo Sage

Hi @tushar_ghadage ,

 

I tried your problem I think we have to create a client script which runs onLoad and from the script we have to make it mandatory false and display also false.

function onLoad() {
    // var annotations = getAnnotations();

	g_form.setMandatory('description', false);
	g_form.setDisplay("description", false);
}

 

 

SarthakKashyap_0-1761719934052.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

 

 

Is the field mandatory from dictionary level...?

Yes it is

SarthakKashyap_0-1761720857057.png

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak