- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 12:53 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 01:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 02:29 AM
@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
2. Configure the client script as follows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 04:28 AM
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 08:41 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 01:06 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 01:58 AM - edited ‎05-02-2024 02:03 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 02:09 AM
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.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Ranjit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 02:55 AM
okay thanku i will try and let you know