how to Update Incident record work notes

RudhraKAM
Tera Guru

Hello Can some one throw some idea for this requirement 

We have a Inbound email action which will create a incident when sent to  our instance with some conditions 

when ever we create an incident, as of now we are adding 2 groups in watch list and adding the work notes via Inbound email action  thinking that it will trigger an email for those 2 groups , but as the operations are on insert emails are not triggered to those groups

We are also inactivating a job when the incident with conditions is inserted , I tried to update the work notes but its not updating.

For the work around I created a notification on incident table and notifing those groups when incident is created with some conditions. 

 How to add work notes after the incidnet is created ? and is there a better way to notify the groups in watch list , when the incident is created 

1 ACCEPTED SOLUTION

You can just add the groups in the watchlist/group list as recipients in the 'who will receive' tab on the notification.

As far as your business rule goes, why are you using the business rule to activate a scheduled job? This won't execute the scheduled job, just tick the active field. Once this business rule has run once that scheduled job will be active so further instances of this business rule won'[t do anything to it.

Why not just run the code in the scheduled job in the business rule? If the code needs so be in the scheduled job and the business rule you can create a script include to hold it and then call that instead.

The worknotes aren't being updated because you have written that line outside of the function that executes the business rule code.

**To sum up: You shouldn't need the business rule at all, you can do everything you need just with a notification. If you absolutely have to have a business rule just run the code you need in there rather than activating a scheduled job. Finally, write all the code you need to run inside the function that runs the business rule code!

View solution in original post

4 REPLIES 4

Dubz
Mega Sage

If you're just alerting those groups that an incident has been assigned to them why can't you just use the OOB 'Incident assigned to group' notification?

we are using that to notify the Incident assigned to group but we need to notify these extra groups , which are in watch list ,, 

 This is the BR which i am using to inactivate and update the work notes , 

just the updating the work notes is not working .

find_real_file.png

You can just add the groups in the watchlist/group list as recipients in the 'who will receive' tab on the notification.

As far as your business rule goes, why are you using the business rule to activate a scheduled job? This won't execute the scheduled job, just tick the active field. Once this business rule has run once that scheduled job will be active so further instances of this business rule won'[t do anything to it.

Why not just run the code in the scheduled job in the business rule? If the code needs so be in the scheduled job and the business rule you can create a script include to hold it and then call that instead.

The worknotes aren't being updated because you have written that line outside of the function that executes the business rule code.

**To sum up: You shouldn't need the business rule at all, you can do everything you need just with a notification. If you absolutely have to have a business rule just run the code you need in there rather than activating a scheduled job. Finally, write all the code you need to run inside the function that runs the business rule code!

Utpal Dutta1
Mega Guru

Hey Kam,

I have a script which you can use to add WorkNotes on any table. I used it for Incident table to print Problem Number which is being added in the Related List.

 

Hope this script comes handy for you:

var gr = new GlideRecord('incident');
gr.addQuery('sys_id',current.parent);
gr.query();

while(gr.next()) {
gr.work_notes="Problem number \t" + current.number +" is added to Incident";
gr.comments="test";
gr.update();
}

 

If this script helps you in any way then please mark my comment Helpful and Correct.

 

Thanks and Regards:

Utpal Dutta

DxSherpa Pvt. Ltd.