Options for Business rule to set assignment group, Category and Sub Category

llbcdl
Giga Contributor

Hello,

I created an on display business rule that will set the Assignment group, Category and sub category for users in a specific department. I used filter conditions to look for the department and actions to set the field values, I didn't script this.

This works great, until one of those users needs to open an incident that should be assigned to another assignment group with a different Category and Sub category. I can't change the fields without the BR reverting them back when I update the incident. Is there a way to have it set the Assignment group, Category and Sub Category by default but then allow the user to change it before submitting the incident? This is also happening if one of the users in the aforementioned department Submits a record producer to create an incident. The Business rule overrides the RP settings.

The intention of the Business rule was to pre populate the fields as a convenience for the department when they submit incidents assigned to their department. The issue arises when they need to submit an IT incident that gets assigned to an IT group. 

Is there a better way to do this?

Thank you,

Charles 

 

 

1 ACCEPTED SOLUTION

Sorry for the delay, thanks for posting the template strings.  Here is your solution/edits to your existing business rule.  Because we need to call the current.isNewRecord() API call, this requires that we make the business rule an "advanced" one and scripting is required.  This is because we cannot check whether the record "is new record" in the filter conditions and we have to utilize the Condition script field instead.

  • At the top of your business rule check the Advanced checkbox
  • On the When to run tab:
    • Uncheck insert and update
    • Set When to display
    • Click the X beside all of your conditions to remove all filter conditions.  This tab should now look like this
    • find_real_file.png
  • On the Actions tab, click the X beside all set field values to remove all of those settings. This tab should now look like this:
  • find_real_file.png
  • On the Advanced tab:
    • Set the Condition to the following:
    • current.isNewRecord() && ["5d9bd582db21ff40b2b77b668c961929", "aee387e8db720b003d3d7d568c961949","11bde863db4aeb40918dff971d961996"].indexOf(current.opened_by.department.toString()) > -1
    • Then paste in the following script:
(function executeRule(current, previous /*null when async*/) {
	/*
 	* This business rule runs only on a new incident when the Opened By User's Department is:
 	* Business Intelligence, Business Application Support (cannot see entire name), or Business Application Support (cannot see entire name)
 	*/
	
	current.assignment_group = "773a332ddb281f405cbf7d598c9619fe"; //SN_BusinessIntelligence
	current.category = "reports";
	current.contact_type = "self-service";
	
})(current, previous);

That should do it!  Since this business rule now runs only on display, your record producers, integrations, etc that create/update incidents in the background won't be affected.  And because the condition contains current.isNewRecord() this will only fire when the user clicks New incident versus firing on existing incidents.

 

Please mark this post or any as helpful or the correct answer if applicable so others viewing may benefit.

View solution in original post

17 REPLIES 17

Narendra Kota
Mega Sage

Hi,

It seems that the script is correct, but hopefully you need to change the type of the business rule. Instead of display, make it

When to Run: -
When: before
Insert: true
Update: true

Keep your script or action as it is what you have written.

Please try it.

Hope this helps.
Mark helpful or correct based on impact.

Thanks.

 

Hi Narendra, 

That didn't change anything. I still can't modify the the fields. The BR keeps setting it back. 

Charles 

johnfeist
Mega Sage
Mega Sage

Hi Charles,

Consider using a client script to populate the fields.  The script can check that assignment group is empty before doing anything.  Keep your field values in a table which the script can easily access.  Doing it this way makes the approach scalable and can enable additional departments to take advantage of your convenience and you just add a row into the table.

Please let me know if you need clarification on any of the above.

Hope this helps.

:{)

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

llbcdl
Giga Contributor

Hi John, 

Do you have an example of the table and script I could use? I am not strong on javascript. 

Charles