Hi there,
I would like to create a jira plugin consisting on a text custom field with its default value equal to the current project name.
I have tried to use the getValueFromIssue but i just works on the issue editing page. In the issue creation page it does not work.
Please any help.
How are you getting the project in the method?
One of the parameters of the getValueFromIssue method is an issue. I get the project by using issue.getProjectObject().getName(). My problem is that in the issue creation page because the issue is not still created
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Eaxctly. But you can get the project from the projectId which is available in the Create Scenario. I think it is there in the ActionContext. Have a look.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, it seems that ActionContext class is what I need but I have tried it by using:
Map session=ActionContext.getSession();
Long projectID=(Long)session.get(SessionKeys.SELECTED_PROJECT);
And I always get a null value for the session. Any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try:
String[] ids = (String[]) ActionContext.getParameters().get("pid");
String pid = ids[0];
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Does ActionContext.getParameters().get("pid") still work in Jira7.2? because i've used it exactly as you said, i mean
String[] ids = (String[]) ActionContext.getParameters().get("pid");
String pid = ids[0];
But it gives me a 500error.
Is there any other way to get the current project's id?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, these last two line seems to work perfectly!!
In ids[0], the current project id is store even when I change the Project in Jira
Thanks a lot!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have a new problem. The last two lines give me the current project ID in the new issue and modify issue pages. However, when I try to clone an issue, I get a NullPointer Exception. Any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally the last problem has been resolved by assigning a predefined default value when ids[] is null or length=0
Thanks again!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.