- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 01:40 PM
So, I have a fairly basic script, that should, in theory, be giving me one specific answer. I'm looking for it to find "Snowflake - HCDA PII Prod" and ensure that the PII Approval checkbox is true. I have tried removing the second feature - the name should be enough.
For some reason, though, it always seems to be returning yes. I feel like I am overlooking something really basic, and I'm going to feel incredibly goofy. I tried with double quotes and single, I tried changing it up to search for the sys_id instead of the name. I tried swapping to an encoded query. It's just always delivering 'yes.' Please someone take a look and put me out of my misery?
answer = ifScript();
function ifScript() {
var catvar = new GlideRecord("u_catalog_item_variables_list");
//catvar.get(obj.mrvs_al);
catvar.addQuery('u_name', 'Snowflake - HCDA PII Prod');
catvar.addQuery('u_needs_pii_approval', true);
catvar.query();
gs.log('VVVVVV info reference- ' + current.variables.sar_system);
gs.log('VVVVVV info NPA- ' + catvar.u_needs_pii_approval);
if (catvar.next()) {
return 'yes';
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 08:15 PM
Hi @Venjamin
If it's returning as yes that means record with that query is present in that table.
Can you check if record is present in the table.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 08:15 PM
Hi @Venjamin
If it's returning as yes that means record with that query is present in that table.
Can you check if record is present in the table.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2023 09:15 AM
Yes, the record is present. Oh man, I think I see what you mean. I forgot to make an actual comparative clause.
It should be checking catvar against the current.variables.sar_system.
I just went too deep. I just need to have it check if current.variables.sar_system = Snowflake - HCDA PII Prod then yes, else no. I knew this was going to be something silly.