The CreatorCon Call for Content is officially open! Get started here.

client script to check 30 days from current date

RudhraKAM
Tera Guru

I have a Select box field "Typeofinterface_interface"  were we have 2 choices :"New" & "replacement" for that  and a  Date Field :" lis_golive_date ."

When user select New in the choice , if the user enter  date, Date cannot be less than 90 days from today it should not submit the value and show an error 

if Replacement is selected in the select box  ,if the user enter  date ,Date cannot be less than 30 days from today,  it should not submit the value and show an error.

 

 

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hi,

Make the golive date field mandatory and write a onchange client script on it.

You might have to write a script include to do the date validations. Here is the link whih could help you.

https://community.servicenow.com/community?id=community_question&sys_id=82fd87addb9cdbc01dcaf3231f9619cb

if(g_form.getValue("u_type_of_interface")=="new") {

//write our logic for data comparison of


}
} else if (g_form.getValue("u_type_of_interface")=="replacement") {

//write our logic for data comparison of

}

Kindly mark the answer as correct/helpful if this helps.

View solution in original post

7 REPLIES 7

Hi Kam,

Did you try the solution that i give you? I tried in my dev instance and it is working fine. Kindly check and mark the answer as correct, if it worked.

The code you provided is not working buddy

Service_RNow
Mega Sage

Hi,

Please refer: maybe you will find some interesting information

https://community.servicenow.com/community?id=community_question&sys_id=9e03cba1dbd8dbc01dcaf3231f96...

 

Thanks