Skip to content

Conversation

@1shabby
Copy link
Contributor

@1shabby 1shabby commented Oct 4, 2025

Built a basic flow action that takes in an update set sys id, then retrieves an array of sys ids containing the sys id of updates that belong to a different application than the one set on the update set. This is serving as a proof of concept of the idea. If I were to build a more robust version, I'd build it in global instead of having it be scoped so I could leverage look up record and look up records steps in the action as well as use an step to create a task or even make an approval and have it fix the mismatch upon the approval being approved.

…trieves an array of sys ids containing the sys id of updates that belong to a different application than the one set on the update set. This is serving as a proof of concept of the idea. If I were to build a more robust version, I'd build it in global instead of having it be scoped so I could leverage look up record and look up records steps in the action as well as use an step to create a task or even make an approval and have it fix the mismatch upon the approval being approved.
@github-actions
Copy link

github-actions bot commented Oct 4, 2025

Valid PR for ActionPack

Thank you for your contribution. This PR complies with the CONTRIBUTING.md.
A maintainer will review this shortly. In the meantime, Happy Hacking!

@1shabby 1shabby changed the title Built a basic flow action that takes in an update set sys id, then re… Action: Update Set / Update Application Mismatch Oct 4, 2025
Copy link
Contributor

@SapphicFire SapphicFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update your script and consider using the JSON Parser step so you can process the objects, or instead provide them as a record list output or equivalent.

Comment on lines 165 to 176
var updateSetGR = new GlideRecord('sys_update_set');
updateSetGR.get('sys_id',updateSetID); // Get the update set for the provided ID.

var updatesGR = new GlideRecord('sys_update_xml');
updatesGR.get('update_set',updateSetID); // Get the updates for the update set provided.

while(updatesGR.next()){
if(updateSetGR.application != updatesGR.application){ // If the application doesn't match between update set and update
flagged.push(JSON.stringify(updatesGR)); // Push stringified update record to flagged array
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of comparing GlideElements, compare the IDs through .getValue()

What is the intent/value of pushing the whole stringified records back? How is a consumer of this action going to work with that, instead of using a JSON parser step or equivalent. Consider swapping to that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sent the data back in that form just because it was a basic approach and I was curious as more of a proof of concept. This also being an action rather than a flow I tried to keep it really basic to the core functionality of finding the problematic records. I'm imagining a second action to actually consume the data from this action that way it's more modular in nature, but I'm also not an architect so if you think it'd make more sense in one action I'm all ears!

Copy link
Contributor Author

@1shabby 1shabby Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier, I had tried just using the non-stringified record since that would be of great value to the user, however I was getting "Could not serialize value" as an error when trying to pass the GlideRecord object through to the array.

I did have some luck by creating my own object with info I cared about and passing that through however. I've got a working version on my PDI that returns the objects, I can push it to my fork and merge again if you'd like. Not sure how you want to handle it

Working Version:
image

Failing Version:
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a special type called Records, which is the ideal style of output for this. But I'm happy to push forward with this, is the live version working as expected?

@SapphicFire SapphicFire self-assigned this Oct 5, 2025
@SapphicFire
Copy link
Contributor

This is a great idea - I'd like to understand your mention of using Global instead, the key issue with querying these tables is that the instance involved wouldn't have the Flow Designer property set to allow those system tables be selected. There isn't a scope restraint in play, though I'm happy for you to share info if you think I'm wrong

@1shabby
Copy link
Contributor Author

1shabby commented Oct 5, 2025

This is a great idea - I'd like to understand your mention of using Global instead, the key issue with querying these tables is that the instance involved wouldn't have the Flow Designer property set to allow those system tables be selected. There isn't a scope restraint in play, though I'm happy for you to share info if you think I'm wrong

Thanks! The reason I mentioned doing it in global instead is so we can leverage the "look up record" & "look up records" steps instead doing it all in a script step. If I just wanted to script this, I'd do it in a script include and reference it here instead, but I can't use those steps due to the tables I'm using being in global. Though I may be wrong, and I'd be happy to be proven as such

… I needed to create my own object as there were some complications in just passing the GlideRecord object back as an output.
@SapphicFire SapphicFire merged commit a21a531 into ServiceNowDevProgram:main Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants