Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

This article provides the code snippet to set a single user picker field from the email address available in a free text field, using the Set field value (JMWE app) post-function.

\uD83D\uDCD8 Instructions

  1. Navigate to the intended workflow to make the necessary changes in the edit mode.

  2. Select the required transition.

  3. Select the Post Functions tab and click Add post function.

  4. Add the “Set field value (JMWE app)” post-function.

  5. Select the target single user picker field in “Field” and select “Value type” as “Groovy Expression”.

  6. Add the below Groovy script in “Value”:

    import com.atlassian.jira.bc.user.search.UserSearchService
    
    def userSearchService = ComponentAccessor.getComponent(UserSearchService)
    def users = userSearchService.findUsersByEmail(issue.getAsString("customfield_10300"))
    users[0]

Replace 10300 in line #4 with the id of the text field, which has the email address.

Click Add and publish your workflow.

Note: The script returns null in the below two scenarios:

  1. The text field is empty.

  2. No user is found for the email address present in the text field.

References

  • No labels