- 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
10-25-2023 11:56 AM
@Community Alums
I have the same requirement, did you find a way to add the work notes to the tasks?
- 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
10-27-2023 12:11 PM
Hello,
I'm glad you found a resolution, which seemed to align with what I mentioned?
Per your original post, you were in a completely different direction and I believe at a minimum...my reply was Helpful?
I see that you've marked your own reply as Accepted Solution, which if that is the case, then ok, but I feel my reply helped guide you to that solution. In the end, everyone's post of their own question and what they ended up doing is the answer, but the context is also what helps you get there 🙂
You can accept more than one reply as well, just fyi.
In any case, it's all about you having a resolution and being successful in your efforts so if that's achieved, it's a win.
Thanks and take care!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2023 06:31 AM
Hello Allen,
I agree that the context and a good question can lead one to find the answer one seeks.
Although, to be frank, regarding the requirements and context, you only alluded to the number of ARs and that part was a good educated guess for sure (probably thanks for a prior similar experience you had with ARs) and I acknowledged that in my reply. But that was merely for you to understand my requirement, to be able to give relevant advice.
The other paragraph you wrote was rather vague regarding the variables, clearly we both meant something else under the same expression. ( i.e. I meant adding global variables to the global context such as current is).
I tried those approaches before even asking it in the community, but since I could not find solutions thru the "straight-forward" routes, I had pursued completely different directions and finally resorted to ask it in the community.
I actually replied to your reply within a couple of minutes, stating that I'm aware of the aforementioned approaches and those didn't work, due to having it tried before.
Then, I proposed half of a solution, if that was what you meant, but never got a reply, until now, when a solution was accepted.
So, I understand you're looking for recognition and validation, but I can't accept your reply as a solution; possibly as Helpful.
Nonetheless, I very much appreciate the time and effort and thank you for that!
Kind regards,
Lori
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2024 10:50 AM
@Community Alums if possible could you share your fix script and business rule?