Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Impersonate 'updateValue' from CustomField

Jonatan Hospital November 9, 2018

Hello,

Is there any way to impersonate the method 'updateValue' from a CustomField? Checked this one, but can't see anything related to ApplicationUser. Maybe it's possible from a fieldManager?  I can't figre it how.

Any suggestion?

1 answer

1 accepted

1 vote
Answer accepted
Jonatan Hospital November 9, 2018

Got it:

 ApplicationUser userDoingAction = ComponentAccessor.getUserManager().getUserByKey(<user_key>);
def issueService = ComponentAccessor.getIssueService()
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.addCustomFieldValue(<customField_id>, <nullable_value>)

def update = issueService.validateUpdate(userDoingAction, issueLinked.id, issueInputParameters)
if (update.isValid()) {
issueService.update(userDoingAction, update)
} else {
log.warn("${update.getErrorCollection().getErrors()}")

 

Jonatan Hospital November 19, 2018

There is a bug, already reported to ScriptRunner: you can't impersonate changes at 'Epic Link' custom field.

Suggest an answer

Log in or Sign up to answer