- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 07:10 AM
Hi, if employee is applying the leave and if the type of leave = planned then the start date should be highlight after one week from the present date.
for the above question i need in client script.
Thanks .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 08:35 AM
Hi,
It is not possible to highlight particular dates in the calendar, you have to apply the conditions in the client script after user selects the dates.
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2023 07:31 AM - edited 07-30-2023 07:33 AM
Hi @DhanrajCh
If I am understanding your question right then I think below should be of help to you. Check this article once.
https://www.servicenow.com/community/developer-articles/no-code-date-validations-through-catalog-ui-...
You can add an additional condition where type of leave is planned and modify the condition for your date valiation to 1 week.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2023 07:47 AM - edited 07-31-2023 07:37 AM
Hello @DhanrajCh
You need to OnChange Client Script :-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var leave = g_form.getValue('type_of_leave');
if(leave == "Planned"){
var d = new Date();
d.addDays(7);
g_form.setValue('start_date', d);
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 03:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2023 08:35 AM
Hi,
It is not possible to highlight particular dates in the calendar, you have to apply the conditions in the client script after user selects the dates.
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2023 07:31 AM - edited 07-30-2023 07:33 AM
Hi @DhanrajCh
If I am understanding your question right then I think below should be of help to you. Check this article once.
https://www.servicenow.com/community/developer-articles/no-code-date-validations-through-catalog-ui-...
You can add an additional condition where type of leave is planned and modify the condition for your date valiation to 1 week.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2023 07:47 AM - edited 07-31-2023 07:37 AM
Hello @DhanrajCh
You need to OnChange Client Script :-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var leave = g_form.getValue('type_of_leave');
if(leave == "Planned"){
var d = new Date();
d.addDays(7);
g_form.setValue('start_date', d);
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 03:46 AM