Our new Appfire Documentation Space is now live!
Take a look here! If you have any questions please email support@appfire.com
Writing your first Groovy script
You need not create a user picker field or configure a post-function for this. The imported backup has everything in place.
Writing the script
Step 1 - Navigate to the post-function
- Go to the Administration icon and click on it.
- Go to Issues - > Workflows
- Locate the workflow GIJ: Task Management Workflow
- Edit it
- Click on transition Approve
- Go to the
Post-functions
tab - Edit the
Set field value
post-function which is the first post-function in the list.
Step 2 - Write the script in the post-function
Write the following script in
Value
currentUser
Line 1 : Using the currentUser variable that holds an
ApplicationUser
representing the current user (i.e. the user triggering the transition) in the Groovy context.Your post-function should look like this:
Step 3 - Test your script
- Click on
Test Groovy Script
. - Input the issue key
GIJ-1
- Click on
Test
- The following result will be displayed.
Step 4 - Save the configuration
- Click on
Update
- Publish the workflow (you don't need to save a backup copy)
Step 5 - Test it on an issue
- Go to the issue
GIJ-1
- Click on the transition
Approve
. - Verify that the
Author who approved
field underPeople
gets updated withJohn Carter.
Use cases
You can use this script in any other relevant context, such as
- Assigning the issue to the current user
- Adding the current user to the Request Participants of the issue