I have 3 custom field. Start date, BigPicture End Date, BigPicture Duration. The BigPicture Duration field data is calculated based on the start and BigPicture end date.
Here is my requirement. - When ever i change the duration, the end date should be modified.Also when the end date is modified the duration should also get updated.
The issue here is wheni change the duration the end date is getting auto-updated, ie, with out the page refresh.But when i change the end date the duration field is not getting auto-updated.But when the page is refreshed the duration field is getting updated.
I want to auto-update the duration field when end date is modified, without page refresh
Code SNIPPET
@Override
public Map<String, Object> getContextMap(ApplicationUser applicationUser, JiraHelper jiraHelper) {
Map<String, Object> contextMap = new HashMap<>();
final Issue currentIssue=(Issue) jiraHelper.getContextParams().get("issue");
if(currentIssue!=null){
final List<CustomField> customFields=ComponentAccessor.getCustomFieldManager().getCustomFieldObjects(currentIssue);
final CustomField durationCustomField=getParticularCustomField(customFields,CustomFieldNames.duration);
final CustomField endDateCustomField=getParticularCustomField(customFields,CustomFieldNames.endDate);
final CustomField startDateCustomField=getParticularCustomField(customFields,CustomFieldNames.startDate);
Timestamp startDate=getStartDate(startDateCustomField,currentIssue);
Timestamp endDate=getEndDate(endDateCustomField,currentIssue);
double duration=getDuration(durationCustomField,currentIssue);
System.out.println("************************************ CustomFields ####################################");
PreviousData.setData(startDate,endDate,duration);
PreviousData.displayData();
if((durationCustomField!=null)&&PreviousData.isDurationModified(duration)){
System.out.println("Inside End date block");
if(startDate!=null){
LocalDate localStartDate=startDate.toLocalDateTime().toLocalDate();
Timestamp modifiedEndDate=getUpdatedEndDate(localStartDate,duration,currentIssue);
if(modifiedEndDate!=null && endDateCustomField!=null){
endDateCustomField.getCustomFieldType().updateValue(endDateCustomField,currentIssue,modifiedEndDate);
System.out.println("Modified End Date\t=\t"+modifiedEndDate);
}
}
}
else{
if(customFields!=null){
System.out.println("Inside Duration block");
duration = (double)getNetworkDays(customFields,currentIssue);
if(duration>-1 && durationCustomField!=null){
durationCustomField.getCustomFieldType().updateValue(durationCustomField,currentIssue,duration);
System.out.println("Duration\t=\t"+duration);
}
}
}
}
return contextMap;
}
Can anyone help me out in this.Please let me know if anymore details are required.
Hello Rahul
I couldn't locate 'BigPicture Duration' field, mentioned in your post. Below is how I tried to locate it, namely in Gantt > View > Column views > Manage column views.
Please paste a screenshot to help me understand which exact field you meant.
I'd rather try to make the problematic field auto-update, so that everybody else benefits from the issue you found, than author the custom script.
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.