- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2017 07:27 AM
Hello Community!
A LDAP inteface is running on our instance. From the source table, the value of the field "Manager" is sent as : cn=313314,CN=3ce5f7a2,OU=IAMIDENTITY,dc=
1 - What I need, is for the transform map to only catch the characters between 'cn=' and ' ,CN= ', so for this example, I want the target field "Manager" to have the value of 313314
2 - This value refers to users ID, however the "manager" field on the sys_user table (which is my target table) associates a user with first and last name. So I need the transform map to extract the user ID, and set the First and last name value unto the "Manager" field in the sys_user table.
I can't seem to have a right script to do so.
Thank you very much for your help!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2017 01:42 PM
Try this on an onBefore transform script
var a=source.u_manager;
var b=a.split(',');
for(var i=0;i<b.length;i++)
{
var c=b[i];
var d=c.split('=');
var manager =d[1];//this will contain the manager employee id
var gr=new GlideRecord('sys_user');
gr.addQuery('user_name',manager);
gr.query();
if(gr.next())
{
target.manager=gr.sys_id;
}
}}
This script will work . Please try it and let me know if it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2017 01:42 PM
Try this on an onBefore transform script
var a=source.u_manager;
var b=a.split(',');
for(var i=0;i<b.length;i++)
{
var c=b[i];
var d=c.split('=');
var manager =d[1];//this will contain the manager employee id
var gr=new GlideRecord('sys_user');
gr.addQuery('user_name',manager);
gr.query();
if(gr.next())
{
target.manager=gr.sys_id;
}
}}
This script will work . Please try it and let me know if it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 03:11 AM
Hi Arka!
It did work. it's perfect! Thank you VERY MUCH