Case to incident work_notes

M_iA
Kilo Sage

We use the case management module in our business and we have users that have the case agent roles, but dont have ITIL.

From cases, we create related incidents where something is broken and those are assigned to our engineers who fix the issues.

We have business rules set up that copy additional comments and work notes from the case to the incident.

However, there are some circumstances where an agent who doesnt have ITIL will add a work note and because they dont have ITIL, the BR to copy the work note across doesnt write as they dont have the permission to do so.

 

What would you suggest as best way forward to resolve this and allow those non ITIL users to be able to add work_notes which copy across?

1 ACCEPTED SOLUTION

Hi @M_iA,

 

Thanks for sharing. Based on the conversation below, I would not setWorkflow(false).

 

Can you share 'when' the Business Rule runs. Is it a before or after? I would actually run this as Async for numerous reason, not least because when running as async it not only prevents holding the current users session, but it will also be processed by a different thread handled by the system user.

 

Can you set the 'When' field under the 'When to run' tab of the Business Rule to Async and confirm please.

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

View solution in original post

12 REPLIES 12

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @M_iA 

 

Try giving thrm only Incident _ write role.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@M_iA 

please share your BR configuration and script being used to copy so that I can help further.

you should use GlideRecord in your BR script and it doesn't evaluate ACL and it should allow the copy

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar, thats what I thought, but without ITIL, it just isnt copying across. Here is the code we are using:

 

(function executeRule(current, previous /*null when async*/) {

	var caseWorknotes = current.work_notes.getJournalEntry(1);
	var relIncident = new GlideRecord('incident');
	relIncident.addQuery('sys_id', current.u_parent_incident);
	relIncident.query();

	if(relIncident.next()){
		// there could be more than one			
		if (caseWorknotes.contains(relIncident.number.toString())) {
			current.work_notes.replace('');
		} else {
			relIncident.work_notes = current.number + ' - '+caseWorknotes;
			relIncident.update();
		}
	}
})(current, previous);

@M_iA 

seems your query is not working

try this

(function executeRule(current, previous /*null when async*/) {

    var caseWorknotes = current.work_notes.getJournalEntry(1);
    var relIncident = new GlideRecord('incident');
    relIncident.addQuery('sys_id', current.u_parent_incident);
    relIncident.setWorkflow(false); // this will disable OOB query BR
    relIncident.query();

    if(relIncident.next()){
        // there could be more than one        
        if (caseWorknotes.contains(relIncident.number.toString())) {
            current.work_notes.replace('');
        } else {
            relIncident.work_notes = current.number + ' - '+caseWorknotes;
            relIncident.update();
        }
    }
})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader