I'm using a SIL script (Power Scripts for Jira), as a post function at transition, to create sub-tasks of a "main" task once it's approved by an approver. i.e. single issue/task is in the approver's queue, then, once approved, 12 sub-tasks are created relating to that initial task.
I'm able to create all the sub-tasks, but have been unable to update additional fields of the sub-tasks that are not defined as part of the createIssue() routine.
startDate and endDate (custom fields customfield_10400 and customfield_10401, respectively, in the code snippet below). Once the SIL script has created the sub-task, how do I directly address and update these 2 custom fields per sub-task? Currently I'm using subTaskKey1.customfield_10400 =, where subTaskKey1 is the sub-task's key created by createIssue(), but it's not working; the start & end date values are not updated.
Do I need to include a reference to the project, and/or to the main task's key, similar to:
projID.mainBuildKey.subTaskKey1.customfield_10400 = ?
Thank you, in advance, for any assistance.
Code sample:
string mainBuildKey = key;
string issueSummary;
string issuePriority = "Minor";
string issueDescription;
string issueProject = "WIB";
string siteCode = customfield_10310;
string issueType = "Sub-Task";
string[] custom_fields_mapping = "customfield_10306|customfield_10307|customfield_10310|customfield_10400|customfield_10401"; //cust name, facil location, site code, start date, end date
// 1st subtask - VM Req (dev, qa, prod as needed)
issueSummary = "VM Request(s) to Platform Team - " + siteCode;
issueDescription = issueSummary;
string subTaskKey1 = createIssue(
issueProject,
mainBuildKey,
"Sub-task",
issueSummary,
issuePriority,
issueDescription, // Description same as issueSummary
{}, // no components
currentDate() + "3d", // DueDate - Platform Team 3 days to provide new VMs
"24h",// ~3 day/24 hour estimate on VM creation
{}, // issue security not set
custom_fields_mapping
);
linkIssue(subTaskKey1, mainBuildKey, "Relates");
subTaskKey1.customfield_10401 = subTaskKey1.dueDate; //set endDate to match dueDate
subTaskKey1.customfield_10400 = subTaskKey1.dueDate - "3d"; //set startDate to 3 days prior to endDate