• 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!

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.

hr assignment rule script servicenow

  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

Assigning the fulfillment group based on user's location using assignment lookup rules in catalog task advance script

I created a script in catalog task in workflow to find the location of the current user and find which assignment lookup rule should be use base on the location. But it's not working.

Appreciate all the help. Thank you.

Evren Yamin's user avatar

2 Answers 2

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

as that would be a Sys ID and not the display value of the location. The script would be running on the current task record, so it's accessed using current . Also, take steps to verify that the field name is indeed task_fulfillment_group .

Shaz's user avatar

Adding on to the given answer, please add the following at the last line of your code, provided that task is also a GlideRecord.

Rupali Bhatnagar's user avatar

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged servicenow or ask your own question .

  • The Overflow Blog
  • From PHP to JavaScript to Kubernetes: how one backend engineer evolved over time
  • Featured on Meta
  • We've made changes to our Terms of Service & Privacy Policy - July 2024
  • Bringing clarity to status tag usage on meta sites
  • What does a new user need in a homepage experience on Stack Overflow?
  • Feedback requested: How do you use tag hover descriptions for curating and do...

Hot Network Questions

  • How can I draw water level in a cylinder like this?
  • Rashi's opinion on the child of a gentile father
  • Submitting a paper as a nonacademic practitioner in a field
  • Dual-555 servo controller: how to "stabilize" without two separate voltage regulators?
  • Uppercase “God” in translations of Greek plays
  • Meaning of “ ’thwart” in a 19th century poem
  • Is the error in translation of Genesis 19:5 deliberate?
  • Is a probabilistic implementation of unitaries invertible?
  • Hotspot vs home internet
  • Picture inside the proof environment
  • Difference between 頁 and ページ
  • Why cant we save the heat rejected in a heat engine?
  • An integral using Mathematica or otherwise
  • Why do we reduce a body to it's center of mass when calculating gain/loss of gravitational potential energy?
  • What are the limits of Terms of Service as a legal shield for a company?
  • CCTV control box connector
  • Invalid coefficients in Quantum Process Tomography of the Hadamard gate
  • Help Identify SMD IC Component Marking 9HH or D9HH
  • Is it possible to approximately compile Toffoli using H and CSWAP?
  • Seth and Cain take turns picking numbers from 1 to 50. Who wins?
  • Which cards use −5 V and −12 V in IBM PC compatible systems?
  • Does gluing two points prevent simple connectedness?
  • A short story about a SF author telling his friends, as a joke, a harebrained SF story, and what follows
  • How to ensure a BSD licensed open source project is not closed in the future?

hr assignment rule script servicenow

Get the Reddit app

Subreddit for ServiceNow users, admins, devs, platform owners, CTOs and everything in between.

Need help with an assignment rule script that will assign all incidents to a particular group between certain hours

Used the script below on the script portion of the assignment rule but it doesnt seem to assigning it to the Help Desk group during the scheduled hours..  This is a fresh OOB developers instance. Any ideas?

var date = new GlideDateTime(current.sys_created_on); var schedule = new GlideSchedule("1b9294741b41011067212f08b04bcbfc"); var flag = schedule.isInSchedule(date); gs.log(flag,'ScheduleCheck'); if(flag == true){ current.assignment_group.setDisplayValue("Help Desk");

By continuing, you agree to our User Agreement and acknowledge that you understand the Privacy Policy .

Enter the 6-digit code from your authenticator app

You’ve set up two-factor authentication for this account.

Enter a 6-digit backup code

Create your username and password.

Reddit is anonymous, so your username is what you’ll go by here. Choose wisely—because once you get a name, you can’t change it.

Reset your password

Enter your email address or username and we’ll send you a link to reset your password

Check your inbox

An email with a link to reset your password was sent to the email address associated with your account

Choose a Reddit account to continue

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. ServiceNow Task Management using Assignment Rules

    hr assignment rule script servicenow

  2. ServiceNow Assignment Rules Demystified

    hr assignment rule script servicenow

  3. Learn about ServiceNow Scripting

    hr assignment rule script servicenow

  4. ServiceNow HRSD HR Assignment Rules

    hr assignment rule script servicenow

  5. Handling Assignment Rules in ServiceNow

    hr assignment rule script servicenow

  6. (Day 4)ServiceNow Business Rule

    hr assignment rule script servicenow

COMMENTS

  1. Create an assignment rule

    Loading... Loading...

  2. Create an assignment data lookup rule

    Loading... Loading...

  3. Example business rule scripts

    Example business rule scripts - Product Documentation: Vancouver - Now Support Portal.

  4. 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.

  5. HRSD 7

    #HRSD #servicenow #snowexpert #snowexpertrohit #plugins #createcase#COE #Topic #HR ServiceHRSD 7 - HR Assignment Rule & Matching Rule - HR Skills & Escalatin...

  6. 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.

  7. Product Documentation

    HR assignment rules use the Resource Matching Engine [com.snc.matching_rule] plugin that is activated with the Human Resources Scoped App: Core [com.sn_hr_core] plugin. You can specify a table and a condition. The base system defaults to Assignment group is empty and Assigned to is not empty. For HR cases that meet these conditions, the hr ...

  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. How can we assign roles automatically to users who are part of an HR

    Here is how I accomplished something similar, used a scheduled job to execute this script include. Scheduled Job: addtohrteam(); Script Include:

  11. HR Assignment Rules getting created in the Global Scope ...

    Due to this, the users responsible for maintaining the IT application have access to update the HR assignment rules which is a serious Loading... Skip to page content Skip to chat. Skip to page content Skip to chat HR Assignment Rules getting created in the Global Scope and not HR. Due to this, the users responsible for maintaining the IT ...

  12. 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);

  13. GlideFilter

    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: The APIs below are intended for scoped applications and may behave differently in the global scope.

  14. Client Scripting

    A Client Script is JavaScript code which runs on the client, rather than the server. Well-designed Client Scripts can reduce the amount of time it takes to complete a form and improve the user experience. However, improperly implemented Client Scripts can significantly slow down form load times. With the exception of the onCellEdit Client ...

  15. 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...

  16. Lab: Create HR Criteria and Bulk HR Cases

    Lab: Create HR Criteria and Bulk HR Cases - Now Learning. September Monthly Speed Networking Event - A Now Learning Community Event Series. Join us on September 10th for a virtual networking event where you will have the opportunity to meet other learners from different industries and career paths, build lasting connections globally, and learn ...

  17. Assignment rule is not working when incident created from ...

    In one of the incident, even assignment rule condition matches, assignment rule is not triggered when the incident created from Record producer.

  18. Business Rules Technical Best Practices

    The When field on the Business Rule form indicates whether the Business Rule script runs before or after the current object is saved to the database. The most commonly used Business Rules are before and after rules. ... If there is no Business Rule to double-check availability, ServiceNow assigns the same item to both requests. By using a ...

  19. r/servicenow on Reddit: Need help with an assignment rule script that

    Subreddit for ServiceNow users, admins, devs, platform owners, CTOs and everything in between. Members Online • ServiceNowSysop. ADMIN MOD Need help with an assignment rule script that will assign all incidents to a particular group between certain hours . HowTo Used the script below on the script portion of the assignment rule but it doesnt ...

  20. Business Rule Scripts

    There are two fields for scripting in the Advanced section: Condition; Script; current and previous. Business Rules often use the current and previous objects in their script logic.. The current object is automatically instantiated from the GlideRecord class. The current object's properties are all the fields for a record and all the GlideRecord methods. The property values are the values as ...

  21. Scripted Assignment Rules In Vulnerability Response

    How can Vulnerability Response assignment be delegated by a script?

  22. Assignment Rule is not working

    Incidents are being created without any value populated in the Assignment Group field (Assignment Rule is failing).