How to use window.location.href.contains() in script include?

Thousif S N2
Tera Contributor

I need to push field as mandatory based on the ui view . So i want to make the validation based on URL using  window.location.href.contains(). So if the url belongs to second UI page then make field as mandatory? But i am trying its not working ! so can any expert help

Thanks in advance

1 ACCEPTED SOLUTION

@Thousif S N 

Would you mind marking my response as correct & helpful if I am able to resolve your query?

Regards
Ankur

 

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

View solution in original post

26 REPLIES 26

hi,

 

Requirement : 

We have a 'Standard change Proposal',so when we creating a new template where we have a configuration item field as Mandatory so once the user saves(not submiting) the form after saving the form users are able to remove the Configuration item field and then they can submit the request so hence in the request CI field will be missing so thiis needs to be avoided ..like this field should be mandatory......

 

find_real_file.png

also we tried adding it in the standard change proposal properties that was also not working as this Configuration Item field is a custom field

@Thousif S N 

You can use onSubmit client script on that table; get the value of template field

Check if that string contains cmdb_ci value or not

Regards
Ankur

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

Thank you it worked finally..

@Thousif S N 

Glad that it worked.

Would you mind marking my response as helpful/correct if I am able to resolve your query?

Regards
Ankur

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