Assignment rules for record producer

imran sk
Tera Contributor

Hi,

we have a record producer "com incident", mapped to incident table. 

We need to leverage the assignment rules table to validate the CI and record producer name.

ex: If the CI is "dell laptop" and record producer is "com incident", then the incident should route to "Hardware" assignment group 

 

How can i validate the record producer name and CI name in the assignment rules table and set the assignment group?

 

Thanks in advance 

 

4 REPLIES 4

Shivalika
Mega Sage

Hello @imran sk 

 

Are you already collecting CI information in your records producer from users ? 

 

If yes, please add below 👇 script in your records producer - 

 

// Set Assignment Group based on selected CI

var ci = producer.cmdb_ci;  

if (ci == 'YOUR_CI_SYS_ID') {  

    current.assignment_group = 'YOUR_ASSIGNMENT_GROUP_SYS_ID'; 

 

}

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Ankur Bawiskar
Tera Patron
Tera Patron

@imran sk 

you cannot access the record producer name in assignment rule script.

Better to use record producer script itself to set the Group

OR

you can use Before insert business rule and check if record was generated from which record producer, check this table "sc_item_produced_record"

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

@imran sk 

Thank you for marking my response as helpful.

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

Amit Verma
Kilo Patron
Kilo Patron

Hi @imran sk 

 

Your requirement cannot be fulfilled with Assignment Rules. You can create a Before Insert Business Rule on sc_item_produced_record table as suggested by @Ankur Bawiskar. Refer below screenshots for reference:

 

AmitVerma_0-1742879231271.png

 

AmitVerma_1-1742879276076.png

 

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

    var incGr = new GlideRecord('incident');
    incGr.get(current.task);
    incGr.query();
    if (incGr.next()) {
        incGr.assignment_group = '8a5055c9c61122780043563ef53438e3'; //Change the sys_id as per the assignment group required
        incGr.update();
    }

})(current, previous);

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.