I have a behavior on field X which links to a custom rest endpoint. I am able to set the value of field X in the return value of the rest endpoint. How can I also set field Y in the same rest endpoint execution?
Essentially, when field X is changed, it should call a rest endpoint and that endpoint should edit both field X and field Y.
For field Y, I am able to find the issue and custom field that I want to change, but am unable to make updates to that field. I am making sure to use issueManager to update the issue once it's been changed, but still no luck. The same code to update a custom field works from within a listener, but doesn't seem to work within a rest endpoint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, can you share your source codes or scripts? I'd like to know what you have...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
and one more question... do you want to change value of Field Y on the screen (using behavior) or using postfunction?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
neither, I'm trying to set the field from code within the rest endpoint but it seems impossible - but the same code works fine from within a listener
// Setup objects
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def componentManager = ComponentManager.getInstance();
def optionsManager = ComponentAccessor.getOptionsManager();
UserManager userManager = ComponentAccessor.getUserManager();
IssueManager issueManager = ComponentAccessor.getIssueManager();
Issue iss = issueManager.getIssueObject(event.issue.toString()); // Pass in the event.issue parameter to find the issue that was modified
MutableIssue issueToUpdate = (MutableIssue) iss;
// Find our custom fields
def fieldX = customFieldManager.getCustomFieldObjectByName('fieldX');
def fieldY = customFieldManager.getCustomFieldObjectByName('fieldY');
// Update custom fields
issueToUpdate.setCustomFieldValue(fieldX,"abc");
issueToUpdate.setCustomFieldValue(fieldY,"123");
// Save the updates
issueManager.updateIssue(currentUser, issueToUpdate, EventDispatchOption.ISSUE_UPDATED, false);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try to use this method:
fieldX.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(fieldX), "abc"), new DefaultIssueChangeHolder())
fieldY.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(fieldY), "123"), new DefaultIssueChangeHolder())
instead of
// Update custom fields
issueToUpdate.setCustomFieldValue(fieldX,"abc");
issueToUpdate.setCustomFieldValue(fieldY,"123");
// Save the updates
issueManager.updateIssue(currentUser, issueToUpdate, EventDispatchOption.ISSUE_UPDATED, false);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What can you see in your Jira log? Is there any exception?
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.