make field mandatory

Deepanshi1
Mega Guru

hi i want to make field mandatory when my comlexity field changes. how can i do it. i have created ui policy for it but it is coming for all value i only have to do when complexity changes.

3 ACCEPTED SOLUTIONS

where do i write this record?

View solution in original post

Sandeep Rajput
Tera Patron
Tera Patron

@Deepanshi1 Here are the steps to create a client script to make a field mandatory.

1. Search for Client script module in Application Filter. >> Click New 

Screenshot 2024-05-02 at 2.51.46 PM.png

2. Configure the client script as follows.

Screenshot 2024-05-02 at 2.54.32 PM.png

View solution in original post

@Deepanshi1 
do it in client script search in application navigator and use onchange on the field


Please accept the solution /mark this response as correct or helpful if it assisted you with your question.




Regards,
Animesh

View solution in original post

17 REPLIES 17

no when form loads complexity field has deafult value as none, so when i select complexity as'simple' still my client script is working its showing 'reason for change' as mandatory. ideally this should not be the case bcz i didnt change it from none to simple rather when i change from complex to simple or vice versa it should work then

Simran Gadodiya
Mega Sage

Hi @Deepanshi1 
You can use on change Client script to achieve this. Hope this helps you if yes accept the solution and mark it as helpful.
Thanks

Anubhav24
Mega Sage
Mega Sage

Hi @Deepanshi1 ,

In your onchange client script that will be written on change of complexity field,

try below code :

var com = g_form.getValue('complexity');

if(com == 'write the value you want to validate')

{

g_form.setMandatory('configuration_item',true);

}

Also you have oldValue and newValue variables in onChange client script you can compare these two values as well in the if condition if the requirement is just to check if the field value has changed or not.

Please mark helpful/correct if my response helped you.

Ranjit Nimbalka
Mega Sage

Hi @Deepanshi1 ,

 

If you want to make field mandatory based on certain value in complexity field then use ui policy.

if you want to make field mandatory whenever value get changed no matter what value it contains then create on change client script below I have given one example.

 

Screenshot (8).png

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Ranjit

 

 

okay thanku i will try and let you know