Trying to load field values in JIRA for a new record, the scripts works except for fields that are rich text or have a drop down value (Select List (single choice)). Any thoughts on a better script (app script in google sheets) or how to update rich text/select list(single choice)?
function createJiraTicket() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var dataRange = sheet.getDataRange();
var data = dataRange.getValues();
var headers = data[0];
var jiraUrl = 'xxxxx';
//var password = 'xxxxx';
for (var i = 1; i < data.length; i++) {
var rowData = data[i];
var summary = rowData[4]; // Assuming the fifth column contains the summary
var reporter = rowData[1]; // Assuming the second column contains the reporter
var webelieve = rowData[9]; // Assuming the tenth column contains the we believe
var businessarea = rowData[3]; // Assuming the fourth column contains the business area
var dueto = rowData[8]; // Assuming the ninth column contains the due to
var willresultin = rowData[10]; // Assuming the eleventh column contains the will result in
var fundingneeded = rowData[13]; // Assuming the fourteenth column contains the funding needed
var portfolioapproved = rowData[14]; // Assuming the fifteenth column contains the portfolio approved
var contractual = rowData[12]; // Assuming the thirteenth column contains the contractual
var name = rowData[2]; // Assuming the third column contains the name
var gtmdate = rowData[6]; // Assuming the seventh column contains the GTM Date
var email = rowData[1]; // Assuming the second column contains the email address
var payload = {
"fields": {
"project": {
"key": "xxx"
},
"summary": summary,
"customfield_62950": dueto,
"customfield_62951": webelieve,
"customfield_62952": willresultin,
"customfield_61250": businessarea,
"customfield_65657": fundingneeded,
//"customfield_65650": portfolioapproved, // This was put in field strategic objective alignment
//"customfield_65653": contractual, // This was put in field in field commercial importance
//"customfield_???": name, // This was put in field what funding is needed
//"customfield_???": GTM Date, // This was put in field customer promise alignment
//"customfield_???": email, // This was put in field do we know the consequential imapacts
"customfield_65660": portfolioapproved,
"customfield_65659": contractual,
"customfield_65656": name,
"customfield_65661": gtmdate,
"customfield_65662": email,
"issuetype": {
"name": "Initiative"
}
}
};
var jsonPayload = JSON.stringify(payload);
var options = {
method: "POST",