- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 09:18 AM - edited 05-26-2025 05:36 AM
Hi All,
I want to copy all worknotes from Interaction to Incident when user clicks Create incident on the worksspace view.
Now, there are multiple Create Incident on Interaction table but I am taking the one which has "Workspace Form Button" as true.
There is a line of code:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 09:47 AM
Hi @Chandler2 ,
I have updated the Create Incident UI action and tested it's working for me try this out
inc.work_notes = current.work_notes.getJournalEntry(-1)
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 10:11 AM
Hi @Chandler2
that should work
which UI action are you updating ? the one that's on the interaction table only right?
as an alternative you can try a BR
(function executeRule(current, previous /*null when async*/) { // Add your code here var incintGr = new GlideRecord('interaction_related_record'); incintGr.addEncodedQuery('type=task^document_table=incident^task='+current.sys_id); incintGr.query(); if(incintGr.next()){ current.work_notes = incintGr.interaction.work_notes.getJournalEntry(-1); } })(current, previous);
you can create a before insert br on incident table with above script as well
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 10:20 AM
Yeah, very weird. It works in my PDI but not on the other instance.
I see multiple Create incident on interaction table but I have choosen the one which has workspace form view as true and that is only one.
Any ideas, what could be happening?
How to know if it is UI action and not a declarative action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 10:48 AM
I think this is the sysid of that UI action a89d504b873303002ae97e2526cb0bdd
should be same in your instance to if not you can check by inspecting the element and copy component name and remove _node1_ the remaining last 32 characters is the sys id of the ui action usually
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 10:54 AM
That is correct, same sys id I have too and below is how the code is placed:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 10:04 AM
your syntax is wrong.
Use the syntax shared by other members.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader