Client script to make field mandatory and validate value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2023 02:01 AM
Trying the set up a client side script to check the time_worked field on the change table. When the change status is being changed to closed complete (3) then it should make the time_worked field mandatory and should not allow the agent to save the state change if the time is less than 15 min. How could I achive this?
I have tried this to make it mandatory with onchange or onsubmit
function onChange() {
if(g_form.getValue('state') == '3')
{
g_form.setMandatory('time_worked', true);
return false;
}
}
but even this part is not working, could somebody advice me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2023 02:59 AM
use above code on onSubmit client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2023 03:08 AM - edited ‎02-18-2023 03:14 AM
Hi @Wasd123 ,
You can achieve this functionality using UI Policy and before update BR.
1. Create UI Policy to make the Time Worked field Mandatory when the state is closed.
2. Create the Before Update BR and configure the condition as shown in the below screenshot:
State changes to closed && Time worked is less than 15 mins.
3. Go to Action tab and select the "Abort Action" checkbox also can configure the message as per requirement. Please see the below screenshot.
Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.
Thanks & Regards
Jyoti Jadhav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2023 04:39 AM
Hi @Wasd123 ,
Were you able to achieve this functionality using the below logic?
Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.
Thanks & Regards
Jyoti Jadhav