- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 10:09 PM
Hi All,
There are two fields are there one is due date and duedate1.
field :due date it is selected user.
field: duedate1 showing current date
I got the requirement when due date field is greater than due date 1 than state of the incident form should go to in progress .
Can you tell me how to achieve this requirement.
Thanks ,
Chandan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 10:21 PM
Hi @chandan2212
did you start working on it ? were are you struck >
You can got to create a onchange client script , someting like below..
var dtStartForm = g_form.getValue('your_field1');
var dtStart = getDateFromFormat(dtStartForm,g_user_date_time_format);
if (dtStartForm != '') {
var dtEndForm = g_form.getValue('your_field2');
var dtEnd = getDateFromFormat(dtEndForm, g_user_date_time_format);
if (dtEnd > dtStart) {
g_form.setValue('state', '3'); // set the value for inprogress
}
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 10:21 PM
Hi @chandan2212
did you start working on it ? were are you struck >
You can got to create a onchange client script , someting like below..
var dtStartForm = g_form.getValue('your_field1');
var dtStart = getDateFromFormat(dtStartForm,g_user_date_time_format);
if (dtStartForm != '') {
var dtEndForm = g_form.getValue('your_field2');
var dtEnd = getDateFromFormat(dtEndForm, g_user_date_time_format);
if (dtEnd > dtStart) {
g_form.setValue('state', '3'); // set the value for inprogress
}
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 03:55 AM
Hi @chandan2212
You can do as suggested by @Sohail Khilji expert or you can use state model as well or may be UI policy and use script to set the State field. but client script is good option.
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 04:32 AM
Hi @chandan2212
You can use following onChange Client Script-
var start = g_form.getValue('your_field1');
var end = g_form.getValue('your_field2');
if (start && end && (new Date(end) > new Date(start))) {
g_form.setValue('state', '3'); // set the value for inprogress
}
Please mark this correct and helpful.
Regards,
Amit