- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 07:26 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 08:44 AM
Hi @pavam,
I'm not sure you're quite understanding me. Can you test the script as a Scheduled Job against 1 specific ticket to ensure the script is working.
I've tested it and it works as expected which is pointing to the encoded query that is not shared.
You can test against a single record by adjusting the script similar to mine.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 07:34 AM
Neither 'username1' or 'inctkts' is defined, I can't see how the script does anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 07:35 AM
Make sure you use the right value for state and remove the extra check. Set a valid user for assigned_to or leave it out.
var t1 = new GlideRecord('incident');
t1.addQuery('assigned_to', username1);
t1.addEncodedQuery(inctkts);
t1.query();
while (t1.next())
{
t1.setWorkflow(false);
t1.assigned_to = '';
t1.state = '1';
t1.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 07:37 AM
Make sure you use the right value for state and remove the extra check. Set a valid user for assigned_to or leave it out.
var t1 = new GlideRecord('incident');
t1.addQuery('assigned_to', username1);
t1.addEncodedQuery(inctkts);
t1.query();
while (t1.next()) {
t1.setWorkflow(false);
t1.assigned_to = '';
t1.state = '1';
t1.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 07:42 AM
Hi @pavam,
I've tried to replicate the Scheduled Job on my PDI with a slight tweak to the script to isolate and test on one specific record.
The syntax looks correct but I've adjusted it slightly and it now works as expected. (You need to remove the space in between the quotes when setting the assigned to value.)
I'd also suggest checking against one record first to ensure it's working correctly before adding your encoded query as you may not be looking at the correct record. It's also good practice to print out some infomation and check numbers before executing an update.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
var t1 = new GlideRecord('incident');
t1.addQuery('number', 'INC0000020', );
//t1.addEncodedQuery(inctkts);
t1.query();
if (t1.next()) {
if (t1.getRowCount() > 0) {
t1.setWorkflow(false);
t1.assigned_to = '';
t1.state = '1';
t1.update();
}
}