
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 05:53 AM - edited 09-29-2023 06:47 AM
Hello Experts! (@Maik Skoddow @sergiu_panaite @Allen Andreas @Chuck Tomasi @DrewW)
I have a use-case and I might be totally overcomplicating it, so I'm willingly putting myself out there and giving the possibility to look foolish.
The use-case is as follows: Identify the Assignment Rule(sysrule_assignment) which run on a task type record. Then, put a worknote on that incident or wm_task or etc., with the Assignment Rule's (AR for the rest of this post) name or sys_id. I'd like to accomplish this on server-side.
For the above, I'd like to track/intercept/trace/listen the update transaction during which the AR is run and the update happens on the Task type record's Assignment Group field. Otherwise, just "simply" get the sys_id of the AR.
Now, I have tried looking at the Event queue for hints and didn't really find anything. (except maybe the metric_update event is fired at one point after the field update)
Then I looked at the Node Logs and it seemed to me, that I found at least a couple of references to what I'm after, but I might be looking in the wrong places:
2023-09-25 01:19:48 (885) http-33 [AMB] AMBClusterBroadcastExtension channel_id=/meta/subscribe message_id=30 cometd_session_id=307ywtuy24a4hgw15shpfwgsub53 glide_session_id=E192CCFC1BA1F95048B860A7234BCB02 user_id=LLLLL glideSessionMappedToHttpSession: true, canReestablishGlideSession: true, isPublicOrUserSet: true, contextName: send /amb/meta/subscribe /sn/rp/sysrule_assignment/4d0682331b99f910e9cc5208624bcb10
2023-09-25 01:20:11 (567) http-39 New transaction E192CCFC1BA1F95048B860A7234BCB02 #475623 /api/now/v1/batch
2023-09-25 01:20:11 (569) Default-thread-7 SYSTEM txid=904324f01ba5 DEBUG: #475623 [REST API] RESTAPIProcessor : Started initializing REST Request
.......
2023-09-25 01:20:11 (577) Default-thread-7 E192CCFC1BA1F95048B860A7234BCB02 txid=904324f01ba5 DEBUG: #475623 [REST API] RESTAPIProcessor : Request Header: referer:https://AAAAAA.service-now.com/now/nav/ui/classic/params/target/sysrule_assignment.do%3Fsys_id%3D4d0682331b99f910e9cc5208624bcb10%26sysparm_stack%3Dno%26sysparm_domain%3Dglobal%26sysparm_domain_scope%3Drecord
From what I've gathered this processor called RESTAPIProcessor is being called here by ServiceNow and that handles this request, at least, from the transaction.
I also see the AMB here, and not sure whether or not it is possible to subscribe(?) to an event from which I can get the necessary info, from the server-side.
I had also tried to use in a BR and in the AR's Script field the following lines, but it returned the task type record.(e.g. incident; I guess in the chain of requests/events the task record was the new initiator at that point):
GlideTransaction.get().getRequest().getRequestURL() OR
GlideTransaction.get().getRequest().getHeader("referer")
Other less documented classes might work, but I did not find those.
I could probably store the existing AR sys_ids in a sys_property or some table, then after the update find the sys_id, but that just doesn't feel right and not very elegant either.
So, as I said in the beginning, there might actually be a much easier solution and I overcomplicated it, thus missing the mark.
In case I didn't, then obviously I don't know enough about the inner workings and architecture of ServiceNow (but I'm more than open to learn it), hence why I'm looking for some help, different point of views or approaches to this.
Thank you for taking the time to read it and looking forward to hearing from you.
Kind regards,
Lori
Solved! Go to Solution.
- Labels:
-
Architect

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 04:35 AM - edited 10-27-2023 04:40 AM
Hello @bekfro,
Ultimately, our solution was two-folds:
- We updated the Script field of the existing ARs with a Fix Script, where we had taken the values from the User/Group reference fields and set the target task(or its child) table's Assignment Group field with the sys_id + Work Notes with the AR name and sys_id.
- We added a before insert/update BR on the AR table to automatically update the Script field, when a user is creating a new or updating an existing AR User/Group.
Hope that helps,
Lori

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 02:32 AM
Hi @bekfro,
Not sure it's still relevant for you, but obviously I can't share all of it. Here's a snippet of the BR on the AR table, your Fix script will basically be the same:
current.script = '//GROUP NAME : ' + groupGR.name.toString() + ', USER NAME : ' + userGR.name.toString() + ';\n';
current.script += 'current.work_notes = gs.getMessage(' + '"' + someMessage + '"' + ', ["' + arName + '"' + ',' + '"' + arID + '"]);\n';
current.script += 'current.assignment_group = "' + groupGR + '";\n';
current.script += 'current.assigned_to = "' + userGR + '";\n';
current.user = '' + '\n';
current.group = '';
Best regards,
Lori
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 09:02 AM
Thank Lori! I was able to solve my issue by leaving the assigned to tab blank on the assignment rule and adding a script for the worknotes and group assignment:
Cheers!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 08:18 AM
Thanks for posting this, it worked for me.
I made some slight modifications so that it would user the group sys_id instead of the name, and update a custom field (u_assignment_group) so I can have this information in a list.
// Set the assignment group using its sys_id
current.assignment_group = 'INSERT_GROUP_SYS_ID_HERE';
// Update the custom field with the name of the assignment rule
current.u_assignment_rule = 'INSERT_ASSIGNMENT_RULE_NAME_HERE';
// Add a work note entry
current.work_notes.setJournalEntry('Assignment Rule: INSERT_ASSIGNMENT_RULE_NAME_HERE');