Need to write business rule where worknotes contains "My Laptop Issue" then only it should assigned to specific assignment group

Shweta Kasbe1
Tera Contributor

Need to write business rule where worknotes contains "My Laptop Issue" then only it should assigned to specific assignment group.

I have written br its not working.Please guide me in this.

  var gr = new GlideRecord('sc_task');
    gr.query();
    if (current.work_notes == 'My Laptop Issue') {  gr.update();
    }

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

update your script as this

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

	// Add your code here
	if (current.work_notes.getJournalEntry(1).indexOf('My Laptop Issue') > -1 ) { 
		current.assignment_group = "groupSysId"; // give group sysId here
	}

})(current, previous);

Regards
Ankur

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

View solution in original post

8 REPLIES 8

Anil Lande
Kilo Patron

Hi,

Can you please share which BR you created and which table?

When task should be assigned to user? On insert/update?

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

find_real_file.png

before-update/insert->There is no as such option where i can mention worknotes contains

Aman Kumar S
Kilo Patron

Hey,

Why don't you use this in Before - Update BR condition, where:

Work notes - Changes AND Work notes - Contain - "My Laptop issue"

and in set field values section you can set the assignment group field.

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

find_real_file.png

There is no as such option where i can mention worknotes contains