Need Help with New Assignment Rule for Record Producer

Kim5
Tera Contributor

Hello,
I'm trying to set up an assignment rule for my "Create Incident" record producer, but I'm not sure how I can add a variable to the condition. I can't find an option to dot walk there so I've temporarily added keywords are wateridge, but that's not working.

On the record producer itself, I added a variable = building location for when a specific business service is selected, to have the user pick the building location.
When the business service = shipping & receiving and the building location = wateridge than I need it to assign to Assignment Group = Shipping & Receiving - Wateridge.

New Assignment rule conditions:
Record producer is Create Incident
Business Service is Shipping & Receiving
Active is true
NEED TO ADD Variable: Building Location = Wateridge

Consideration: we have another assignment rule for all incidents that come in are assigned to the Help Desk assignment group. The Assignment rule condition for that is simply Active is true and the execution order is 1,000. How can I make sure they work in sync, i.e. one doesn't negate the other? Is it with execution order or do I have to write it into the conditions?

Or if variables won't work here with conditions, can I have a script instead? If so, can you provide an example that I can plug in what I need in?

Thank you, Kim

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

Within the script section, you would be able to use:

current.variables.variable_name

So for the end-result values of the assignment rule, you would want to use the script section to accomplish the assignment rule execution.

So if...

if (current.variables.variable_a == "apple") {
current.assignment_group = 'sys_id' // or use gs.getProperty('property_name');
}

For execution information:

The order in which the assignment rule is processed. If assignment rules conflict, a rule with a lower-order value takes precedence over a rule with a higher value. If the order values are set to the same number, the assignment rule with the first matching condition takes precedence over the others. Only the first assignment rule with a matching condition runs against a record.

https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/task-table/task/t_A...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

15 REPLIES 15

Allen Andreas
Administrator
Administrator

Hi,

Within the script section, you would be able to use:

current.variables.variable_name

So for the end-result values of the assignment rule, you would want to use the script section to accomplish the assignment rule execution.

So if...

if (current.variables.variable_a == "apple") {
current.assignment_group = 'sys_id' // or use gs.getProperty('property_name');
}

For execution information:

The order in which the assignment rule is processed. If assignment rules conflict, a rule with a lower-order value takes precedence over a rule with a higher value. If the order values are set to the same number, the assignment rule with the first matching condition takes precedence over the others. Only the first assignment rule with a matching condition runs against a record.

https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/task-table/task/t_A...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thank you, thank you, Allen. This is exactly what I needed. One thing that I should have mentioned is that there are two separate assignment groups depending on what business service is selected. Is that something that I need to script in as well or would I put that in the "Applies to" tab? Can you have a script AND the Applies to conditions filled out or does it have to be one or the other? Sorry, that might sound like a stupid question, but I'm still learning how all of this works. 

Also, can what I need to accomplish be done in one assignment rule or do they have to be separated out into two different assignment rules? 

Thank you very much for your time and help with this.  

 

find_real_file.png

 

Hi,

I'm glad my reply above was Helpful.

For your other questions, if you can try and fit it into one assignment rule (that just so happens to have the same condition), then you can build out if, else if, else type analysis in your script.

The applies conditions would be evaluated first and then once in the "door" it does the rest.

So to limit this from running for ALL types of records on this table, you could specify some sort of unique condition to then go inside and use your script, etc. to do advanced actions.

So the process order is like this:

1) Applies to is evaluated to see if this assignment rule is even relevant to the process

2) Assign to is next

3) Script - which could override assign to settings if you cover the same information again

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thank you! I'm going to keep them separate because I don't think I can get the else if statements down right at this point. Would you mind telling me how I can add the two if conditions into one? I tried looking up other community articles, but I'm struggling with the correct way to write it. If you aren't able to help me with something so specific, I totally understand. Here's what I tried:

if (current.variables.please_select_the_location_where_services_are_needed == "wateridge" && (current.variables.cmdb_ci == '15ea90c5dbbda700627ff8f3399619cd')) {
current.assignment_group = '6e3efda2db61f8101d51ff0968961914'
}

Thanks for all your time and help.