[RESOLVED] Is there a way to get Custom Fields data from user's profile?

Hi,

Is there a way to get data from "customAttribs"?

I can get login, fullName, email and so on.

...
"customAttribs": "[{"$$type": " CustomProfileAttribute", "name": "Position"},
{"$$type": " CustomProfileAttribute", "name": "Department"},
{"$$type": " CustomProfileAttribute", "name": "Division"},
{"$$type": " CustomProfileAttribute", "name": "Signature"}]",
"firstDayOfWeeks": "1",
"language": "English",
...

How can I read Custom Fields data (values) from user's profile? Not only names.

0
4 comments

Hi,

you can use the attributes property as provided in the User entity documentation.

const user = entities.User.findByLogin('root');
console.log('the user department is ' + user.attributes.Department);
0

It's kind of weird, but it works, thanks.

0
ctx.currentUser.attributes['Department']

This one is better.

0

Well, it's the same thing in JavaScript, so you can use whichever you prefer. 

0

Please sign in to leave a comment.