Hi Naveen,
In order to start writing scripts, you should know what are the tables/views to query for getting the required information.
I strongly recommend you to go through the the blog IDM SQL Basics #1: Queries against the Identity Store by Per Krabsetsve
Anyways I am writing down the sample scripts for your reference, which you can make use of.
Let me know for any further queries.
1. For getting the MSKEY of the user from MSKEYVALUE
// Main function: z_sap_getMskeyForMskeyvalue
function z_sap_getMskeyForMskeyvalue(Par)
{
var msKey = "";
msKey = "select distinct mcMSKEY from idmv_entry_simple where mcMSKEYVALUE='"+Par+"'";
msKey = uSelect(msKey);
return msKey;
}
2. For gettting the DN of the Manager with MSKey as the input to the script.
// Main function: z_sap_getManagerADDN
function z_sap_getManagerADDN(Par)
{
var msKey = Par;
var managerADDN = "";
managerADDN = "select avalue from idmv_value_basic where MSKEY="+Par+" and AttrName='ACCOUNTIDECAD'";
// in the above select query ACCOUNTIDECAD is my AD account attribute. In your case it is ACCOUNT<AD Rep Name>
managerADDN = uSelect(managerADDN);
return managerADDN;
}
All the best !!
~ Krishna.