-
Notifications
You must be signed in to change notification settings - Fork 913
Create incident task with same group as incident record. #1922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| var incRec = new GlideRecord('incident'); | ||
| incRec.addEncodedQuery('assignment_group=287ee6fea9fe198100ada7950d0b1b73^active=true'); // encoded Query to get incients assigned to particular group | ||
| incRec.query(); | ||
| var eQry = incRec.getEncodedQuery(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add comment to show that this returns the encodedQuery |
||
|
|
||
| while(incRec.next()){ | ||
| var iTask = new GlideRecord('incident_task'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are not executing this query. Additionally, why are you looking at incident_task here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WillemZeiler I am using eQry to apply the query below. The requirement was to have an extra record for reporting purpose later. |
||
| iTask.initialize(); | ||
| iTask.applyEncodedQuery(eQry); | ||
| iTask.setValue('incident', incRec.getUniqueValue()); | ||
| iTask.insert(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| /* This script will glide all active incidents assigned to a particular group and create incident task with same group. | ||
| This make use of applyEncodedQuery. | ||
| */ | ||
|
|
||
| 1.In any GlideRecord query retrieve query using getEncodedQuery() | ||
|
|
||
| 2.Apply this encoded query to create/update records (you can apply this query to other tables if query is appropriate). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have examples where you used this and why? That way it will add value in addition to the standard documentation: https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/GlideRecord/concept/c_GlideRecordAPI.html
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WillemZeiler This was a client requirement, where for a particular group they wanted a task generated to log some internal extra work they were doing during some of their internal transition. This was done through a scheduled job (daily) for the required period and then the scheduled job was deactivated. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using a sys_id, can you in the comment add what it refers to?