In JMWE, I'm running an Event-based action to "check" if the reporter of an issue is linked to a company/organization, and if so, apply the organization name to the issue based on that (often they come in blank, especially when by email). I have found that the same company has a couple different names in different projects (example: Company in one project and CompanySPECIALDEPT in another), and there's occasionally overlap of the people/reporters (they're linked to two different companies in two different projects).
Below is my current Nunjucks code for how to set the issue (on the post function "set issue"). When I test this code with one of the users who exists in two projects as above, it's applying the organization name as it appears in a different project than the one the issue was logged under (not sure if it's where they FIRST were linked, or if it's alphabetical)
Any thoughts on what I could add to make it pick the result from the "same" project as the issue was logged under?
{% set result = "/rest/servicedeskapi/organization?accountId=:issue" | callJira(params={"issue":issue.fields.reporter._accountId}) %} {{ result.values[0].name }}
Alternatively, if, instead of having the context of "all" of my projects on this action, I had it as a separate event-based action that only defines one specific project - should that solve? (I just tested this with the problem project, and it still seemed to pick the Org name from the "other" project that the user exists under).
You can use project related endpoint
rest/servicedeskapi/servicedesk/{serviceDeskId}/organization
to get the organisation used in the specific project.
ServiceDeskId can also accept projectKey or projectId. -> docu.
Regards, Samuel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.