We use a custom field "Student". When an issue is created a default value should be set. It should be the current user.
I have no programming skills, but we use scriptrunner. Somebody an idea?
Thank you very much for your advice!
Hello,
It would be something like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
def user = ComponentAccessor.getJiraAuthenticationContext.getLoggedInUser()
def studentCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Student")
issue.setCustomFieldValue(studentCF, user)
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
Put this script into a scripted post function and put this post function last in the list of post functions.
It should already be visible when the create issue screen is seen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then it should be a behaviour with a script like this:
import com.atlassian.jira.component.ComponentAccessor
if (getActionName().equals("Create") {
def user = ComponentAccessor.getJiraAuthenticationContext.getLoggedInUser()
def studentCF = getFieldByName("Student")
studentCF.setFormValue(user);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I solved this issue now by using Live Fields with the following script:
string currentUser=currentUser();
if(argv["screen"]=="create") {
lfSet("Student",currentUser);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.