JJUPIN Set field value from user property value

Jenifer Kuntz December 15, 2014

I am using JJUPIN to pull in a user property that has been pulled from LDAP.  

The field is comes in like this - 

CN=FirstName LastName, random stuff I don;t need, more stuuf...

Is there a way to only bring in the first name and last name?

This is the code I am using

customfield_10100 = getUserProperty(reporter, "manager");

1 answer

1 accepted

1 vote
Answer accepted
FlorinM
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 15, 2014

Hi Jenifer,

Well, depends on what information was actually pulled from LDAP to the user properties. If there's a property that only has the manager's first and last name, then you can just use that property (maybe check with your admins if they can add one such property). Otherwise you'll just have to chop around that string to only leave the first and last name (drop first 3 chars and everything after the first comma, assuming the rule is the same for all users). 

Another option would be to use the http://confluence.kepler-rominfo.com/display/SIL30/ldapUserStruct routine and query the LDAP directly.

Hope this helps!

Jenifer Kuntz December 17, 2014

This - Otherwise you'll just have to chop around that string to only leave the first and last name (drop first 3 chars and everything after the first comma, assuming the rule is the same for all users). Is what I think I need to do, can you give me a starting point on how I can code that?

FlorinM
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 17, 2014

Once you have the full proprty value returned by getUserProperty, you can find the first index of a comma using http://confluence.kepler-rominfo.com/display/SIL30/indexOf and then http://confluence.kepler-rominfo.com/display/SIL30/substring starting at index 3 and ending at the index returned by indexOf. Note that indexOf returns -1 if comma is not found. More string manipulation routines here: http://confluence.kepler-rominfo.com/display/SIL30/String+Routines Hope this helps!

Suggest an answer

Log in or Sign up to answer