- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2020 08:57 AM
Hoping somebody can help me figure this out.
I'm creating a form where the user can create a new vendor where they need to fill out a handful of mandatory fields.
Once created, they need to select if the their contract will take place at the same office or not.
This is essentially the same concept of filling out your address and then having a checkbox to confirm if your billing address is the same and will self-populate if you check yes.
Per my alerts I'm getting into the 'if' statement and my values seem to be generating within the statement.
However, when the info is not getting generated on my form, they're simply showing as blank and mandatory. Which is essentially what would happen if they selected 'No' instead of 'Yes' in the Contract location is the same as above' field.
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2020 12:51 PM
Finally figured this one out.
Strange enough, it ended up being a UI policy that simply controlled the visibility of of that particular section.
I tried changing the order of the UI policy and the client script but I couldn't come to any combination between the two that worked for some reason.
I ended up controlling the visibility of that section with a UI policy centered around a different field/condition.
Thank you everybody that took the time to assist/help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2020 09:02 AM
Hi,
are all the variable names proper which you are using during g_form.setValue()
Even if 1 variable name is incorrect it would break the script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2020 09:15 AM
I went back and copy and pasted the variable names to my script to make sure I didn't have any typos. It's still not working.
I appreciate the reply.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2020 09:06 AM
This also depends on data type of these variables on your catalog item.
e,g if you have reference variable, then you need to update sys_id and NOT name.
e.g choice list field need value and NOT choice label when you are doing setValue()
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2020 09:08 AM
Hi there,
Don't see anything strange so quickly. I would suggest you just breakdown your code a bit. Just comment some lines, test what is working, until it breaks... so you know which line(s) is causing your issues.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field