How to check Work Notes has been updated or changed in server side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2016 12:02 PM
Hello Guys,
I have a requirement where I need to send the WorkNotes of Incident from Snow to Remedy.
I am using getJournalEntry(1) to get the last updated work notes and send it to Remedy, till that it is fine.
Now if the WorkNotes is not updated still getJournalEntry(1) will send the same last updated work notes to Remedy, thus making duplicate entries in Remedy.
I wanted to know, How can we check whether WorkNotes has been updated or not. If there is no worknotes then nothing should be sent to Remedy.
FYI: I used current.work_notes.changes(), but that didn't work
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2016 01:02 PM
If you are doing this via a business rule, it is pretty simple, simply use the when to run filter, it will work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2016 01:32 PM
Hi Laurent,
Thanks for the reply.
But I am not doing via Business rule. I need to do it in a Script Include which is called by Script Action.
Ajay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2016 01:48 PM
When is your Script action triggered, is it on update, or does this looks more like a scheduled job. Because to be able to use .changes() the record needs to be actually changing not has been changed.
If what you are running is more a sync job than ServiceNow pushing the work notes as they come (I think you would have made a BR if your goal was to push as they come). Then you would probably need to update your synced record at the end of the job (set a custom field to true) and filter these out for your upcoming sync. And you could have a business rule with the when to run work notes changes that would set back that field to false.
If this is not helping you, could you please tell me more about your Script Action and Script Include, in which context are they called?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2016 08:25 PM
Hi Laurent,
Below is the logic:
1) When a record is updated and update event is called
2) This update event in turn calls our script action (written on update event)
3) This script action in turn calls a script include
4) In script include I am pushing all the updated values from Incident to staging form
5) Then a async Business rule is triggered (written on update of staging form) which calls the SOAP update action and sends to Remedy.
My requirement is to find a way to check whether work_notes has been updated or not (above step 4) which I am not able to find.
Let me know if you need more information.
Thanks,
Ajay