ServiceNow: Building Powerful Workflows by Tim Woodruff, Ashish Rudra Srivastava, Martin Wood

Get full access to ServiceNow: Building Powerful Workflows and 60K+ other titles, with a free 10-day trial of O'Reilly.

There are also live events, courses curated by job role, and more.

Setting the Assignment group with Assignment Rules

Assignment Rules are a simpler alternative to Data Lookup. While Data Lookup is very powerful, allowing you to set any field, it does involve a quite a bit of configuration, including creating a new table.

In contrast, an Assignment Rule uses the simpler condition builder to specify when it should run. If it matches, then it'll either populate the Assigned to and Assignment group fields with a hardcoded value, or you can use a script. We have got the group we want to use in a property, so this option is perfect. Follow these steps:

  • Name : Assign to External Team
  • Table : Maintenance [x_hotel_maintenance] ...

Get ServiceNow: Building Powerful Workflows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Don’t leave empty-handed

Get Mark Richards’s Software Architecture Patterns ebook to better understand how to design components—and how they should interact.

It’s yours, free.

Cover of Software Architecture Patterns

Check it out now on O’Reilly

Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.

servicenow assignment rules script examples

developer portal logo

Your browser or one of your plugins is not allowing JavaScript to be run. This is a bummer since the ServiceNow Developers Site is dynamic and depends on JavaScript to function. If you want to visit this site, please disable the plugin, activate this site for JavaScript or use another browser.

  • ServiceNow Consulting Services
  • ServiceNow IT Workflows
  • ServiceNow Customer Workflows
  • ServiceNow Employee Workflows
  • Hyperautomation
  • ServiceNow Implementation Services
  • ServiceNow Integration Services
  • ServiceNow Managed Services
  • ServiceNow for Manufacturing Industry
  • Digital Transformation In Banking
  • Digital Transformation In Insurance
  • Digital Transformation in Wealth & Asset Management
  • Digital Transformation in Life Sciences
  • Digital Transformation in Hospitals
  • Digital Transformation for Payers
  • Data Migration Utility
  • 360 Degree Business Assessment
  • ServiceNow Dx Support
  • Service Automate
  • Rome Release
  • Case Studies
  • News Events
  • Infographic
  • Thought Leadership

Handling Assignment Rules in ServiceNow

In ServiceNow, if one is looking for automatic assignments then he can rely on the instance’s ability to assign the tasks automatically to different users and groups depending on the specified conditions. In order to achieve this, ServiceNow has the following modules:

  • Assignment Lookup Rules
  • Assignment Rules

Assignment Lookup Rules:

This module appears under the ‘System Policy application’ menu. This table is basically generated out of the box as its definition is provided in the ‘Data Lookup Definition’ table in the instance, specifically for field assignments in the incident table. Assignment lookup rules mainly provide the functionality of changing any field value and not just the assignment fields.

Assignment Rules:

This module appears under the ‘System Policy application’ menu. It helps to automatically assign the tasks to a particular user or a particular group using the assigned_to and assignment_group fields respectively, depending on the specified set of conditions. One can define these assignment rules readily for their desired table.

Following are the steps for defining the assignment rule:

  • Navigate to System Policy -> Assignment -> New

Handling Assignment Rules in ServiceNow

  • From the above figure, one can see that the dot-walking can also be done in the condition builder field. Just select the ‘Show Related Fields’ option in the condition and then select the appropriate attribute.
  • Further, in the ‘Assign To’ tab, select the appropriate user and group to whom the task is to be assigned.

If two assignment rules conflict, then the assignment rule with the lowest execution order runs first. The lower the execution order, the higher is the precedence.

Distinguishing Factors between the Data Lookup Rules and Assignment Rules:

Precedence among the assignment rule and business rule:.

In certain circumstances, the business rules gain precedence over the assignment rules.

The business rules and assignments rules run in the following order:

  • All the ‘before record insert’ business rules having order less than 1000.
  • First and foremost, assignment rule with lowest execution order and matching condition.
  • All the ‘before record insert’ business rules having order more than 1000.
  • All the ‘after record insert’ business rules.

We are pretty sure that this blog must have given an overview of dealing with Assignment Rules in ServiceNow.

Any comments\suggestions are most welcome. We have posted further blogs as well on other topics and will frequently come back with something innovative.

Share This Story, Choose Your Platform!

Configure group types for assignment groups

Use the Type field to define categories of groups. Once defined,\n you can use these categories to filter assignment groups based on the group type using a\n reference qualifier.

For example, when selecting an assignment group from the Incident form,\n Type can be used to filter groups based on whether they are typically\n involved in the Incident management process. Groups such as Network or Help Desk are displayed\n as they are typically involved. Groups such as HR or New York are omitted.

The following items are provided in the base system.

  • The types catalog , itil , and\n survey .
  • The reference qualifier on [task.assignment_group] filters on [Type] [equals]\n [null] .
  • A reference qualifier named GetGroupFilter is available to filter for\n group types using Create a dynamic filter option .

Add a new group type

You can add additional group types to filter assignment groups for tasks.

You may need to configure the form to display the Type \n field.

  • \n Navigate to All > User Administration > Groups . \n
  • \n Select a group record. \n
  • \n Click the lock icon beside Type . \n
  • \n Click the lookup icon beside the selection field. \n The Group Types dialog opens. \n
  • \n Click New . \n
  • \n Enter the group type name and description. \n For example, to define a type for a group as\n incident and problem ,\n enter: incident,problem . \n Click Submit . \n
  • Optional: \n Add additional group types if needed. \n
  • \n Click Update . \n

Assign a group type

You can assign group types to filter assignment groups for tasks.

  • \n Navigate to All > User Administration > Groups and select the desired group. \n
  • \n Click the lookup icon beside the selection field and select one or more group\n types. \n \n Note: Because the default behavior of\n task.assignment_group is to filter out groups with\n group types defined, adding a type to a group filters it out of the\n Assignment Group field on tasks. To change the\n behavior, set up the reference qualifier. \n\n \n

ServiceNow Guru Logo

Advanced Reference Qualifier Using a Script Include

R eference qualifiers are a powerful tool that every ServiceNow administrator and consultant should have in their tool belt. They allow you to dynamically filter the available options from a reference field. The ServiceNow wiki has some good documentation on this topic so I won’t re-hash that here. What I do want to address is the topic of Advanced Reference Qualifiers…specifically how to leverage a Script Include instead of a global Business Rule to run your qualifier script.

Reference Qualifier Script Include

Up until recently, the only way to get Advanced Reference Qualifiers to work was to create a global business rule to run the qualifier script. This works great, but it results in a global script that gets loaded all the time when it really isn’t necessary. While this isn’t something that causes any real problems in practice, it could cause performance issues if used to the extreme. The best practice guidance for advanced reference qualifiers should be to use a Script Include rather than a global Business Rule to run the qualifier script. Using a Script Include means that the script only gets loaded and used when you actually need to use it! In this article I’ll show you how this can be done using a common example of filtering the ‘Assignment group’ to display only groups for the ‘Assigned to’ value.

The first piece is the ‘Reference qual’ field value on the dictionary entry of the reference field (Assignment group in this case). The ‘javascript:’ prefix is the same, but you need to reference your Script Include function instead of the business rule function. In this case, I’m using a Script Include named ‘u_backfillAssignmentGroup’. Since these scripts can potentially interfere with each other, it’s best to prefix any of your custom scripts with ‘u_’ or something similar in order to distinguish them from any that ServiceNow may introduce in the future.

The other piece is obviously the Script Include. Since Script Includes now allow you to use On-Demand functions, your script is identical to the one you would use in a global business rule.

servicenow assignment rules script examples

Mark Stanger

Date Posted:

June 21, 2011

Share This:

20 Comments

' src=

Script Includes can be a single function, too. That would reduce the complexity of this a bit. Tom Dilatush’s blog speaks to it. I use “on-demand” functions all the time for Advanced Reference Qualifiers.

http://community.service-now.com/blog/slightlyloo …

' src=

You’re right, that’s much easier! I’ve updated the article above accordingly.

Is it possible that i can dynimically change reference table on a field based on value in the another field? for example, if a table has two columns – A and B. A is of type string. B is of type reference. Can I change reference table on B based on value in A?

You would need to use a completely separate field to do that.

can you use script include in clientscripts?

Yes, there is a checkbox that enables client callable..

found it in the wiki,

Is there a way to use the same script include for client side and server side calls?

I had to make 2 different script inludes to cater each.

I am using a Script Include as a reference qualifier, but it is behaving rather strangely. When I click the magnifying glass, I get the filtered results, if I type ** in the reference field, I get the filtered results, but when I try to type in the value of what I want Firebug reports an error saying “response.responseXML is null”. The reference field filters Business Services related to the company of the caller, I created a m2m table with a related list on both Company as well as Business Services. Any idea why this is happening?

When adding the Tree Picker, is there a way when user pick a member of the group it would be able to populate the Assigned To and Assignment Group in one pick?

No way to do that currently.

Is it possible to put an condition in the attribute field? if the assign_to field is not empty then tree_picker=false.

I don’t believe so.

Can this be used on a Service Catalog variable?

made this a little bit more versatile. you can use it on Service Catalog variables as well. You can call it from any reference field’s advanced qualifier, as you can specify the reference field targettable

Tested it out and works…

Now reviewing setting the default value of the reference field to the first retrieved record, on change of the filtervaluefield

Any feedback is welcome ;-) (as I’m quite rusty in my scripting, and a newbie in Snow)

Thanks for the contribution! Please keep us up-to-date on any modifications or improvements you make.

Hey Mark, thanks for the article I’m trying to do this exact thing – create a Script Includes to use as a reference qualifier and I’m having issues, can you help?

Here is what I have so far:

But I’m still getting the following errors: WARNING at line 9: Missing semicolon.

ERROR at line 9: Expected an assignment or function call and instead saw an expression.

I’m assuming that after I get this script correct I’d just need to create a dynamic or advance reference qualifier on my assignment group field (ie javascript: u_INC_FilterAssignmentOnDisableTrigger)…… am I right?

Hey April. These types of questions are probably better suited to the ServiceNow community site. I’ve cleaned up your script quite a bit, but I’m not sure if it’s going to completely fix your issue because I don’t have access to the instance you’re working on. This script should eliminate the errors you’re seeing (and solve several other issues I noticed). If you have further questions please ask on the ServiceNow community site.

Hi I have a problem: I call a Script Include in the assignmnent_group field of the incidents… but unfortunately I found the same call also in the assignmnent_group of Changes and Problems. How can I fix this problem?

You must create a dictionary entry override for the incident table. In order to do that you need to do the following: Configure the dictionary of assignment_group Go to the Dictionary Overrides related list Click new and specify the table you want to override, in your case the Incident. Check the Override reference qualifier and populate the Reference qualifier field with your script include. Save the record.

Comments are closed.

servicenow assignment rules script examples

Randall King says:

  • Business rules
  • Client scripts
  • Content management
  • Email Notifications
  • General knowledge
  • Graphical workflow
  • Integration
  • Knowledge Management
  • Miscellaneous
  • Relationships
  • Script includes
  • Service Portal
  • Single Sign-on
  • System Definition
  • Web Services

Related Posts

Send a Knowledge Link when Attaching Knowledge

Send a Knowledge Link when Attaching Knowledge

Modifying the Label of Form Fields With Client Scripts

Modifying the Label of Form Fields With Client Scripts

Prevent Circular Relationships in ServiceNow

Prevent Circular Relationships in ServiceNow

Fresh content direct to your inbox.

Just add your email and hit subscribe to stay informed.

servicenow assignment rules script examples

Since 2009, ServiceNow Guru has been THE go-to source of ServiceNow technical content and knowledge for all ServiceNow professionals.

  • Application Portfolio Management (APM) assessment challenges
  • Knowledge Translation using Localization Framework and Azure
  • Localization framework fulfillment (LP, LRITM, LFTASK)

© Copyright 2009 – 2024 | All Rights Reserved

web analytics

developer portal logo

Your browser or one of your plugins is not allowing JavaScript to be run. This is a bummer since the ServiceNow Developers Site is dynamic and depends on JavaScript to function. If you want to visit this site, please disable the plugin, activate this site for JavaScript or use another browser.

IMAGES

  1. Task Assignment Rules in ServiceNow CSA Tutorial for Beginners

    servicenow assignment rules script examples

  2. ServiceNow Assignment Rules Demystified

    servicenow assignment rules script examples

  3. ServiceNow Task Management using Assignment Rules

    servicenow assignment rules script examples

  4. ServiceNow How

    servicenow assignment rules script examples

  5. Learn about ServiceNow Scripting

    servicenow assignment rules script examples

  6. ServiceNow Express: Assignment Rules

    servicenow assignment rules script examples

VIDEO

  1. ServiceNow

  2. SERVICENOW Assignment Data Lookup Rules and Transfer maps @SERVICENOW_Beginners

  3. ServiceNow ACL Demo Debugging

  4. ServiceNow ACL Table.* vs Table.none

  5. ServiceNow Access Control List Series In Hindi

  6. Scripting in ServiceNow part -1

COMMENTS

  1. Create an assignment rule

    Create an assignment rule and apply it to a single table. Assignment rules are designed to run at the time you open a record.

  2. servicenow

    Judging by the table name that looks like a data lookup table. Is there any reason why you are not trying to implement this requirement using the Data Lookup Definitions rather than Assignment Rules? If you are insistent on taking this route, then the last line should read. current.task_fulfillment_group.setValue(assignment_group);

  3. 29. Use cases of Assignment Rule in ServiceNow

    Contact us: https://www.facebook.com/SNow-Knowledge-154868872024336/1. What is Assignment Rule?2. Use cases with live demonstration.

  4. Exploring Advanced Work Assignment

    Queues can be defined based on need or type, for example product or critical cases. You also identify the agent groups responsible for work in the queue. AWA then applies assignment rules that you set and use agent availability, capacity, skills (if defined), and shifts (if defined) to assign work to the most qualified agent.

  5. ServiceNow Assignment Rules Demystified

    "ServiceNow Assignment Rules: The Secret Sauce to Being a Productivity Ninja"Hey there, fellow ServiceNow enthusiasts! Today, we're going to talk about Assig...

  6. Business Rules Technical Best Practices

    Async Business Rules allow ServiceNow to return control to the user sooner but may take longer to update related objects. Follow these guidelines to determine which value to choose for the When field. Value. Use Case. display. Use to provide client-side scripts access to server-side data. before. Use to update information on the current object.

  7. Controlling record access using 'Before Query' business rules

    These business rules have a 'When' value of 'Before' and also have the 'Query' checkbox selected. 'Before Query' business rules are only used when you need to restrict access to certain rows within a table for certain groups of individuals. Because the security is controlled by a script, the restriction can be applied based on ...

  8. #8 Configure Assignment Rules in ServiceNow

    If you want to support me then by me a coffee- https://www.buymeacoffee.com/saaswnowThis is ITSM Implementation Mock Training. In this tutorial you will lear...

  9. Setting the Assignment group with Assignment Rules

    If it matches, then it'll either populate the Assigned to and Assignment group fields with a hardcoded value, or you can use a script. We have got the group we want to use in a property, so this option is perfect. Follow these steps: Navigate to System Policy > Rules > Assignment, and click on New. Use the following values, and Save.

  10. Scripting in ServiceNow

    Although you can do a lot on the ServiceNow platform without writing code, the ability to script is a powerful skill. In this course you will use your existing JavaScript skills to add functionality to the NeedIt application. You will learn to write, test, and debug common script types including: Client Scripts, UI Policies, Business Rules, and Script Includes. This course does not teach ...

  11. Handling Assignment Rules in ServiceNow

    One can define these assignment rules readily for their desired table. Following are the steps for defining the assignment rule: Navigate to System Policy -> Assignment -> New. Fill in the appropriate details. The below figure is for reference: From the above figure, one can see that the dot-walking can also be done in the condition builder field.

  12. Configure group types for assignment groups

    Navigate to All > User Administration > Groups. Select a group record. Click the lock icon beside Type. Click the lookup icon beside the selection field. The Group Types dialog opens. Complete the following steps. Click New. Enter the group type name and description. For example, to define a type for a group as incident and problem , enter ...

  13. Checking for Modified or Changed Fields in Script

    Identifying modified or changed fields in Client scripts. When looking at a form in Service-now, it's usually pretty easy to identify the fields that have changed since the form loaded (as seen in the screen shot above). The green field indicators give a simple visual cue to the user. Behind the UI, the system is taking cues as well and ...

  14. Advanced Reference Qualifier Using a Script Include

    Using a Script Include means that the script only gets loaded and used when you actually need to use it! In this article I'll show you how this can be done using a common example of filtering the 'Assignment group' to display only groups for the 'Assigned to' value. The first piece is the 'Reference qual' field value on the ...

  15. Service Now Beginners Workshop Assignments

    Assignment # 1. Customize 'Group' (sys_user_group) Form by adding a new field called 'Parent Group' and reference this field to Groups table (sys_user_group) Export all the existing groups ...

  16. GlideRecord

    ServiceNow provides JavaScript APIs for use within scripts running on the ServiceNow platform to deliver common functionality. This reference lists available classes and methods along with parameters, descriptions, and examples to make extending the ServiceNow platform easier. Please note: These APIs are provided to support legacy applications in the global scope. It is recommended that new ...