importing user in sys_user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 12:00 AM
i m importing user in sys_user table but i have to check condition about no duplicate records and also don't add user who don't have group
so where i have to write condition in script or in business rule when running transform map
and also wanna count of row that inserted successfully
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 03:31 AM
Hi Ankit ,
Make a field like user name or id which is unique as coalesce field. This will prevent creation of duplicate record. In import and transform history (also in import progress bar shows that) you can check the number of successful inserts/update/ignored.
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
Thanks,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 03:55 AM
Hi Ankit,
While importing data in serviceNow using Import sets, you can mark a field as unique. By marking a field unique, ServiceNow check that field value already exist or not in target table. (unique filed is called Coalesce Field)
If value does not exist then a new record is created against that value
if value exist, then fields of corresponding record are updated in case their is change in you imported data.
> You can mark any field Coalesce while creating a transform map or going to already created transform map
> when you open a transform map
> Look at the related list "Field Maps" you'll see a column with name "Coalesce"
> Change the value from false to true against whichever field you want to mark as unique.
NOTE: Out of Box transform map for user table "sys_user" has "email" field as coalesce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 05:07 AM
Ankit,
You need to check for the users group membership in the sys_user_grmember. If found set the ignore=true, this will skip inserting the record where the user is member of any group. For duplicates just use coalesce on any unique field like email etc.
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("user.email",source.u_email);
gr.query();
if(gr.next())
{
gs.log(" record found");
ignore = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 05:41 AM