- 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 08:29 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 09:50 PM
Hi Sanasunilku,
The code is working me in background script,
but when i am executing the same code through schedule job ,
t1.assigned_to = ''; is updating and
t1.state = '1'; is not getting update.
so , i just want to know what other parameters are effecting to my code.
Thankyou.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 09:44 AM
When i am hitting the above script in the background script it is working fine.
but when i am running the same script through schedule job,
Assigned_to value is updating and state='1' is not updating in the table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 09:51 AM
Hi @pavam,
Can you entertain me and adjust your script similar to mine (by targeting a single ticket) as a scheduled job and confirm the behavior please.
I've tested and confirmed this works as a Scheduled Job (Specifically a Scheduled Script) for an individual ticket.
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 09:53 PM
Hi Robbie,
below is the code.
var t1 = new GlideRecord('incident');
t1.addQuery('assigned_to', username1);
t1.addEncodedQuery("numberSTARTSWITHINC^active=true^stateIN2,3,6");
t1.query();
while (t1.next())
{
t1.setWorkflow(false);
t1.assigned_to = '';
t1.state = '1';
t1.update();
}
you can add "username1" any sys_id value from sys_user table.
what other parameters are effecting