I have a request form with some insight fields on it. I am trying to set the value of the insight fields on the form (this is BEFORE the issue is created). The script looks like:
def countryField = getFieldById("customfield_16805")
def storedObjectBean = objectFacade.loadObjectBean(theCountryId)
countryField.setError(storedObjectBean.toString()) // this works -> Canada (TVM-256028)
//none of these work
Since the issue is not yet created, there is no issue variable and I cannot use the mutableIssue.setCustomFieldValue() which usually works.
oh, i didn't notice the "working" part was about setting error message, not field value.
anyways, looks like it's impossible to do via behaviour:
but you can add a postfunction on creation transition and set it there
First of all, are you working on Cloud or Server?
You can use a mutable issue as you mentioned, why can't you use it? (I imagine you are using updateIssue when you use mutableIssue.setCustomFieldValue)
Also, this can be easily done with a post function, which will update the custom field's value.
The script is run on the customer portal, during the initial submission of the form, I.E. the issue is not yet created (hence why there isn't an issue variable and the web IDE reports an error when using it)
The scenario requires all operations be done on the portal in real time while the client is populating the fields
I really do not know how to explain it better. I am using service desk mapping for the behavior. If I try to use
MutableIssue mutableIssue = (MutableIssue) issue;
I get "The varibale [issue] is undeclared" which is normal, since there is no issue created yet, hence I cannot use the methods provided there.
I am sharing a piece of my script that uses mutable issue. Hope it helps:
IssueService issueService = ComponentAccessor.getIssueService()
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
// Create new issue from email
IssueService.CreateValidationResult createValidationResult = issueService.validateCreate(user, issueInputParameters)
IssueService.IssueResult createResult = issueService.create(user, createValidationResult)
log.error("Error while creating the issue.")
def testIssue = createValidationResult.getIssue()
MutableIssue mutableIssue = issueManager.getIssueObject(testIssue.getId())
mutableIssue.setCustomFieldValue(textCf, "Some text value")
Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events