Hi
I am trying to somehow through scriptrunner postfunction pick a value of user profile element created via this plugin https://marketplace.atlassian.com/apps/1212508/user-profiles-for-jira?hosting=server&tab=overview
Cannot find any proper method for this except by wrtiting a direct sql to database where this object is stored. Can anyone help?
Hello Lucas,
you can get (reading) access to profile elements when you map them to custom Jira fields as described in our documentation. Is this what you are looking for?
If you are looking for an API access this feature is not part of User Profiles for Jira.
Cheers,
Nadine
Communardo Products
Hi @Lukasz Andrzejewski ,You may have solved your issue a long time ago, but it may still help someone I hope))In this script, I take the value of the text element from the Profile called (example) Department
import com.atlassian.sal.api.user.UserKeyimport com.onresolve.scriptrunner.runner.customisers.PluginModuleimport com.onresolve.scriptrunner.runner.customisers.WithPluginimport de.communardo.atlassian.plugins.userprofile.external.api.model.data.TextBasedProfileElementDataimport de.communardo.atlassian.plugins.userprofile.external.api.model.elements.TextBasedProfileElementimport de.communardo.atlassian.plugins.userprofile.external.api.service.UppProfileElementDataManagerimport de.communardo.atlassian.plugins.userprofile.external.api.service.UppProfileElementManagerimport static com.atlassian.jira.component.ComponentAccessor.getJiraAuthenticationContext@WithPlugin("de.communardo.jira.plugins.userprofile")@PluginModuleUppProfileElementManager uppProfileElementManager@PluginModuleUppProfileElementDataManager uppProfileElementDataManagerdef reporter = new UserKey(getJiraAuthenticationContext().getLoggedInUser().getKey())TextBasedProfileElement textbasedProfileElement = uppProfileElementManager.getProfileElement(1);TextBasedProfileElementData data = uppProfileElementDataManager.getProfileElementData(reporter, textbasedProfileElement);def departmentData = data.getText()
Please take into account that you need to change your int .getProfileElement(1) acording to your ProfileElement IDBest regards
It looks like you're new here. Sign in or register to get started.