Monday 7 March 2016

Selective Hiding: Domain Separation for List Data

Domain separation is the technique by which we let users view only a selective range of data. The data visibility is defined by the domain in which the user is residing and we add a similar column to our concerned table as Domain. The filtering is done by ServiceNow by matching the domains and letting a user view only the data that falls into his domain,

For this, what we may do as an advanced step is separating the users based on their company and adding a Company field in our table which will decide the domain view. I'll tell you how!!

First, create a column named domain....do not save before you read this fully. Column type will be Domain as well. Change the column name from u_domain to sys_domain before you save anything.

After you'll save, ServiceNow will create a column named Domain Path for its reference. Now, all you need to do is convert your Company name to Domain. For this, we will be writing a Business Rule which will run before Insert and Update.

Below is the script you need to add in Advanced tab -

var defdomain = current.u_company; //the value from company field - sys_id since it is a ref field
var chgdomain = ""; //variable to store domain value

var compcheck = new GlideRecord('core_company');
compcheck.addQuery('sys_id', defdomain); //find the record of the company
compcheck.query();
if (compcheck.next()) {
chgdomain = compcheck.sys_domain.getDisplayValue(); //get the domain value from company table
}

updatesoftdomain();
function updatesoftdomain()
{
current.sys_domain = chgdomain;
current.update();
}


Done Done Done...!! :)

9 comments:

  1. Great Article. its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    servicenow online course hyderabad

    ReplyDelete
  2. ServiceNow provides comprehensive lifecycle management of Amazon resources. Incorporate Amazon offerings into your enterprise service catalog, integrate AWS Config with the ServiceNow CMDB, and manage usage and costs of Amazon resources at the application, service and cost center levels. Implement efficient incident, problem and change management of services deployed through AWS CloudFormation.

    ReplyDelete
  3. Good article.It is very useful for all of us.more interesting from the starting lines until the end.
    http://www.calfre.com/India/Hyderabad/ServiceNow-Training/listingcity

    ReplyDelete
  4. Thanks for sharing valuable information and very well explained.Keep posting.

    servicenow online training
    best servicenow online training

    ReplyDelete
  5. I’d need to examine with you here. Which isn't one thing I normally do! I get pleasure from reading a publish that can make individuals think. Additionally, thanks for allowing me to remark! app entwickeln berlin


    ReplyDelete
  6. Wow, marvelous weblog layout! How lengthy have you been blogging for? you made blogging glance easy. The full glance of your web site is wonderful, as smartly as the content! app entwickeln berlin

    ReplyDelete