cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Experts,

I have a weird issue I'm hoping you can help me with. I'm trying to find out why a value that I'm trying to set with uIS_SetValue is showing an error in the attribute value instead of what I'm feeding into the function. Here's the script in question, see line 26 (I have marked it):

// Main function: z_setDN


function z_setDN(Par){ 
	var split = Par.split("||");
	var adLogin = split[0];
	var startPoint = split[1];
	var mskey = split[2];
	var prefix = Left(adLogin,3);
	var IDStoreID = uGetIDStore();
	var country = "";
	var city = "";
	var entity = "";
	var finalResult = "";
	var sql = "";
	var uISResult = "";
	
	if(prefix == "ADM" || prefix == "ADS" || prefix == "CYB" || prefix == "EXU") {
		uISResult = uIS_SetValue(mskey, IDStoreID, "Z_MX_AD_" + prefix + "_LOGIN_ID", adLogin);
		if(prefix == "EXU") {
			finalResult = "cn=" + adLogin + "," + startPoint;
		} else {
			finalResult = "cn=" + adLogin + ",ou=Users," + startPoint;
		}
		uWarning("finalResult (pre-set of Account_DN_AD>: " + finalResult);
Line26:		uISResult = uIS_SetValue(mskey, IDStoreID, "Z_MX_ACCOUNT_DN_AD_" + prefix, finalResult);
		uWarning("uISResult: " + uISResult);
	} else {
		uISResult = uIS_SetValue(mskey, IDStoreID, "Z_MX_AD_INTERNAL1_LOGIN_ID", adLogin);
		sql = "select SEARCHVALUE from IDMV_VALUE_BASIC \
				where ATTRNAME = 'Z_MX_AD_TRIGRAM' and MSKEY in ( \
				select MCSEARCHVALUE as MSKEY from IDMV_VALLINK_BASIC \
				where MSKEY = " + mskey + " and MCATTRNAME = 'MXREF_Z_MX_OFFICE_LOCATION_MAPPING')";
		city = uSelect(sql);
		sql = "select SEARCHVALUE from IDMV_VALUE_BASIC \
				where ATTRNAME = 'Z_MX_COUNTRY' and MSKEY in ( \
				select MCSEARCHVALUE as MSKEY from IDMV_VALLINK_BASIC \
				where MSKEY = " + mskey + " and MCATTRNAME = 'MXREF_Z_MX_OFFICE_LOCATION_MAPPING')";
		country = uSelect(sql);
		sql = "select SEARCHVALUE from IDMV_VALUE_BASIC \
				where ATTRNAME = 'Z_MX_LEGAL_ENTITY_AD' and MSKEY in ( \
				select MCSEARCHVALUE as MSKEY from IDMV_VALLINK_BASIC \
				where MSKEY = " + mskey + " and MCATTRNAME = 'MXREF_Z_MX_LEGAL_ENTITY_MAPPING')";
		entity = uSelect(sql);
		finalResult = "cn=" + adLogin + ",ou=USERS,ou=" + entity + ",ou=" + city + ",ou=" + country + "," + startPoint;
		uISResult = uIS_SetValue(mskey, IDStoreID, "Z_MX_ACCOUNT_DN_AD_INTERNAL1", finalResult);
	}


	uWarning("finalResult: " + finalResult);
	// uSetContextVar("Z_NEW_ACCTDN", finalResult);
	// uSetContextVar("Z_NEW_LOGIN_ID", adLogin);	
	// uSetContextVar("Z_USR_MSKEY", mskey);
	return finalResult;
}

Also, here's the screen shot with the values of the uWarning messages from lines 25 and 27:

As you can see, the value of, "finalResult" is a valid AD DN and the uIS_SetValue result is a, "+", meaning that it executed properly. However, here's the value of the attribute when I query the database:

Why is there an error in there? Everything is configured properly. This makes no sense. Has anyone seen this before?

0 Likes
View Entire Topic
devaprakash_b
Active Contributor
0 Likes

Hello Brandon,

!ERROR - this result will come, if the mentioned attribute is not available. I tried the below code and it is working as expected.

Please check whether the attribute is existing or not.

Regards,

Deva

// Main function: test  

function test(Par){ 
        //Example calling DSE internal function 
        //uStop("Terminated by user"); 
        var rep = "SAP_SYSTEM"; 
        var mskey = Par.get("MSKEY"); 

        var OutString = uIS_SetValue(mskey,1,"ACCOUNT"+rep,"userid"); 
        uWarning(OutString); 
        return ; 
}
brandonbollin
Active Participant

Ahhh... So even though the attribute is present in the schema, if the user doesn't already have that attribute on their account, uIS_SetValue cannot do an, "insert" of the attribute. It can only do a, "modify". Is that a correct summary? When I read SAP's documentation more closely, it does say that uIS_SetValue, "Updates the value of a given attribute for a given entry..." To me, update does not mean add. SAP's documentation also strongly recommends using a To Identity Store pass to update / add attribute to identities instead of this function due to unpredictable results.

OK. I will try to rewrite my process to work around this limitation and see what happens. I will update once I have a result. Thanks!