Forums

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

Modifying Custom Field Value does not affects SLA rule

Kleber Fonseca
Contributor
August 15, 2018

I have a SLA Rule that is influenced by a custom field value. This custom field is a single list with two options: Low (target/objective is 8 hours) and Hight (target/objective is 2 hours).

The target is modified always that I change the option (Low/Hight) in the screen as an user.

But when I change this custom field value using groovy (script runner) the target stays the same.

 

How to "wake" or "recalc" SLA in this situation ?

 

I have used this two codes but they doesn't worked...

What I have to do is to copy the option selected in the same customField from a "cloned" Issue (issueOrigin) to issue that has the SLA (issueSLA) to affects the target time .

Someone helps... ? Thanks in advance

 

My attempty 1: CustomField is modified but does not changes the target time

def myField= ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName( fieldName )
String valueStr = issueOrigin.getCustomFieldValue(myField)
def valueOpc = ComponentAccessor.getOptionsManager().getOptions(myField.getRelevantConfig(issueOrigin)).getOptionForValue(valueStr , null)

 

myField.updateValue(null,  issueSLA, new ModifiedValue( issueSLA.getCustomFieldValue(myField), valueOpc ), new DefaultIssueChangeHolder() )

 

My attempty 2: CustomField does not changes. Nothing happens...

def issueService = ComponentAccessor.getIssueService()
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()

issueInputParameters.addCustomFieldValue(myField.getId(), valueStr)

def updateValidationResult = issueService.validateUpdate( user, issueSLA.getId(), issueInputParameters);

if (updateValidationResult.isValid())
{
issueService.update( user , updateValidationResult);
if (!updateResult.isValid())
{
   //never runs here
}
}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events