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

Oh I also need the template value from the XML too so I can include that into the script as well.  Thanks!

<filter_condition table="incident">opened_by.department=5d9bd582db21ff40b2b77b668c961929^ORopened_by.department=aee387e8db720b003d3d7d568c961949^ORopened_by.department=11bde863db4aeb40918dff971d961996^EQ<item goto="false" or="false" field="" endquery="true" value="" operator="=" newquery="false"/></filter_condition>

llbcdl
Giga Contributor
<template>
assignment_group=773a332ddb281f405cbf7d598c9619fe^category=reports^contact_type=self-service^EQ
</template>

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.

llbcdl
Giga Contributor

The screen shots are after the changes recommended by Narendra. I deactivated it temporarily until I can resolve the issue.