Spaces:
Sleeping
Sleeping
Delete uploaded numbered files
Browse files
291-getting-the-current-user-groovy.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
# Getting the current user - Groovy
|
| 2 |
-
|
| 3 |
-
> المصدر: https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930944/Getting+the+current+user+-+Groovy
|
| 4 |
-
|
| 5 |
-
---
|
| 6 |
-
|
| 7 |
-
### Abstract
|
| 8 |
-
|
| 9 |
-
This code snippet fetches the user who triggered the current transition.
|
| 10 |
-
|
| 11 |
-
### Logic
|
| 12 |
-
|
| 13 |
-
This snippet uses the [currentUser](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461799437 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461799437") built-in variable to fetch the ApplicationUser object representing the user who triggered the current transition.
|
| 14 |
-
|
| 15 |
-
### Snippet
|
| 16 |
-
|
| 17 |
-
`currentUser`
|
| 18 |
-
|
| 19 |
-
### Examples
|
| 20 |
-
|
| 21 |
-
The output of this code snippet is an [ApplicationUser](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461472599 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461472599") object representing the current user which you could use in:
|
| 22 |
-
|
| 23 |
-
**A Groovy template, for example to:**
|
| 24 |
-
|
| 25 |
-
- Set a user picker field to the current user. Eg: Save the user who "coded" an issue into an "Implemented by" custom User Picker field for traceability and reporting purposes or Assign an issue to the current user in
|
| 26 |
-
|
| 27 |
-
- one of the Set Field Value post-functions
|
| 28 |
-
- the Create issue post-function under Set fields of new issue section
|
| 29 |
-
- Conditionally execute a Post-function/Condition/Validator or Unlink issues - Eg: Check that the current user is the Reporter of the issue
|
| 30 |
-
|
| 31 |
-
`issue.get("reporter") == currentUser`
|
| 32 |
-
|
| 33 |
-
**A Groovy template, for example to:**
|
| 34 |
-
|
| 35 |
-
- Notify the customer that the issue raised by them is being handled by the current user through the
|
| 36 |
-
|
| 37 |
-
- Comment in one of the Comment issue post-functions
|
| 38 |
-
- Subject/HTML body/Text body of Email issue post-function
|
| 39 |
-
|
| 40 |
-
`Hi <%=issue.get("reporter").getName()%>. Your issue is being handled by <%= currentUser.getDisplayName() %>`
|
| 41 |
-
- Write a JQL search expression in the Link issues to current issue post-function - Eg: Link issues assigned to the current user
|
| 42 |
-
|
| 43 |
-
`assignee = <%= currentUser.getName() %>`
|
| 44 |
-
|
| 45 |
-
### References
|
| 46 |
-
|
| 47 |
-
- [currentUser variable](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461799437 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461799437")
|
| 48 |
-
- [ApplicationUser interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461472599 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461472599")
|
| 49 |
-
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide "http://groovy.codehaus.org/User+Guide")
|
| 50 |
-
|
| 51 |
-
### Related articles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|