I need to allow user onlt to select date that is one week later.

niveditakumari
Mega Sage

Hi, 

 

I need to allow user only to select date in date field that is one week later from today date. I have created one field that is date type field in catalog item. 

I need to allow user only to select date that is 1 week later from today date. 

Can anyone please help me to achieve that. 

 

Regards, 

Nivedita 

 

 

3 ACCEPTED SOLUTIONS

J Siva
Tera Sage

Hi @niveditakumari 
You can create one Catalog UI policy to do the validation.
PFB.

JSiva_0-1741775230240.pngJSiva_1-1741775246736.png

 

JSiva_2-1741775282310.png

 

Hope this helps.
Regards,
Siva

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@niveditakumari 

no scripting required. you can simply use UI policy and you need not worry about the date format

No Code date validations through (Catalog) UI Policies 

use this in UI policy condition

Your Date relative before 7 days from now

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Juhi Poddar
Kilo Patron

Hello @niveditakumari 

You can achieve this requirement using UI policy

Refer the screenshot for more details:

Ui Policy Configuration:

JuhiPoddar_0-1741776132115.png

Ui Policy script to show error message:

function onCondition() {
	g_form.showErrorBox('date',"Please select date after 7 days from today");
}

Result:

JuhiPoddar_1-1741776278516.png

JuhiPoddar_2-1741776301479.png

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

View solution in original post

13 REPLIES 13

Hi @niveditakumari 

Would you mind creating a new community post for this. Since this thread is already closed, this query may not get noticed by other community members.

 

Regards,

Siva

Ankur Bawiskar
Tera Patron
Tera Patron

@niveditakumari 

no scripting required. you can simply use UI policy and you need not worry about the date format

No Code date validations through (Catalog) UI Policies 

use this in UI policy condition

Your Date relative before 7 days from now

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@niveditakumari 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@niveditakumari 

Thank you for marking my response as helpful.

As per new community features you can mark multiple responses as correct.

If my response helped please mark it correct as well so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar

 

I need to allow user to select date after 7 days but it should calculate only business days not weekend. In our project as per client we follow Friday, Saturday as weekend and I need to exclude Friday, Saturday. When user select date then it should calculate for Sunday, Monday, Tuesday, Wednesday, Thursday as business day.  

Can you please help me with that. 

 

Regards, 

Nivedita