I'm changing the custom field name using the REST api in JIRA. It is changing the custom field name suceessfully. But when I tried to get the custom filed in the code, I'm getting null as the result.
String modByWhomCustomFieldName = pluginConfigService.getMUFCustomFieldName();
System.out.println("+++++++++++++++++++In flagCustomField() modByWhomCustomFieldName is:"+modByWhomCustomFieldName);
//CustomField modByWhomCustomField = cfManager.getCustomFieldObjectByName("Description Changed By");
CustomField modByWhomCustomField = cfManager.getCustomFieldObjectByName(modByWhomCustomFieldName);
if(modByWhomCustomField != null) {
System.out.println("++++++++++++++ "+modByWhomCustomField.getDescription());
}
In the above it is not entering into the if conditon.
Edited from here. Whenever user changed the description of an issue, I'm displaying that user. For this I have created one custom field of type "UserCFType" . It is displaying the user who modified the description. But for user admin, it is displaying admin(admin) . I just want "admin" only not "admin(admin)".
Object modByWhomCustomFieldOldValue = issue.getCustomFieldValue(modByWhomCustomField);
Object modByWhomCustomFieldNewValue = user;
System.out.println("+++++++++++++++++++In flagCustomField() current user is:"+modByWhomCustomFieldNewValue.toString());
ModifiedValue<Object> modifVal2 = new ModifiedValue<>(modByWhomCustomFieldOldValue, modByWhomCustomFieldNewValue);
modByWhomCustomField.updateValue(null, issue, modifVal2, changeHolder);
The above is the code for that.