JJUPIN Set field value from user property value

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

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!

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?

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

110 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you