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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

521 views 1 18
Join discussion

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