Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Date selected should be within 2 days from current date in catalog client script.

Deepak Shaerma
Mega Sage

Hi Community,

I make a date field variable on a catalog page and I need that date selected should be within 2 days from the current date. 

1 ACCEPTED SOLUTION

PavanK960672992
Mega Patron

Hi @Deepak Shaerma ,

You can use the UI policy to achieve this.

1. Create a catalog UI policy and use below conditions on your date variable.

Conditions: User not to select the date 2 after days from now and not past date.

Screenshot (568).png

2. Script: Give your variable name and msg as per requirement.

function onCondition() {
    g_form.clearValue("start_date");
    g_form.showFieldMsg('start_date', "Please select date as 2 days from now", "error");
}

Screenshot (569).png

Result: Display msg user selects incorrect date.

Screenshot (570).png

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

5 REPLIES 5

Hi @Deepak Shaerma ,

refer below

https://www.servicenow.com/community/developer-forum/how-to-set-assignment-group-from-catalog-item-w...

If you didn't get create separate question.

Try to search in community definitely you will find many solutions related to it.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar