Open Bhavya-ss opened 5 days ago
"Will Tide be sharing any personal data in the execution of the contract?" = "Yes" OR "Will Tide be sharing any other confidential information, other than personal data?" = "YES" OR "How critical to Tide's business operations would the counterparty be?" IN ("Business important", "Business-imperative") OR "Would the counterparty have any access to existing Tide systems (e.g. Jira, Confluence, Google Drive, etc.)" = "Yes" OR "Would there by any API integration?" = "Yes" OR "Would the counterparty integrate any source code within our services?" = "Yes"
sharingPersonaldata == "Yes" || anyOtherConfidentialInformation == "YES" || (["Business important", "Business-imperative"].contains(howCriticaltoTideBusinessOperation)) || counterpartyhaveanyaccess == "Yes" || apiIntegration == "Yes" || counterpartyIntegrate =Yes= ""
import groovy.json.JsonSlurper
def sourceProjectKey = "LSD" def targetProjectKey = "ISSD" def issueTypeNameToCheck = "Submit a request or incident"
def issueKey = issue.key
// Check if the issue is in the source project if (issue.fields.project.key == sourceProjectKey) { def summary = issue.fields.summary def description = issue.fields.description def reporter = issue.fields.reporter def requestType = issue.fields.customfield_10848?.requestType?.name def sharingPersonaldata = issue.fields.customfield_11931?.value def anyOtherConfidentialInformation = issue.fields.customfield_11932?.value def howCriticaltoTideBusinessOperation = issue.fields.customfield_11933?.value def counterpartyhaveanyaccess = issue.fields.customfield_11934?.value def apiIntegration = issue.fields.customfield_11935?.value def counterpartyIntegrate = issue.fields.customfield_11936?.value
if (requestType == "New Tide Contract" && (sharingPersonaldata == "Yes" || anyOtherConfidentialInformation == "Yes" || ["Business important", "Business-imperative"].contains(howCriticaltoTideBusinessOperation) || counterpartyhaveanyaccess == "Yes" || apiIntegration == "Yes" || counterpartyIntegrate == "Yes")) { def issueTypesResponse = get("/rest/api/2/issuetype") .header('Content-Type', 'application/json') .asObject(List)
if (issueTypesResponse.status == 200) {
// Check if the security update was successful def targetIssueTypeId = 10288 // Replace with the actual target issue type ID
def createIssuePayload = [
fields: [
project: [
key: targetProjectKey
],
summary: summary,
description: description,
reporter: [
id: reporter.accountId
],
issuetype: [
id: targetIssueTypeId
]
]
]
def createResult = post("/rest/api/2/issue")
.header('Content-Type', 'application/json')
.body(createIssuePayload)
.asObject(Map)
if (createResult.status == 201) {
def newIssueKey = createResult.body.key
def linkResult = post("/rest/api/2/issueLink")
.header('Content-Type', 'application/json')
.body([
type: [
name: "Problem/Incident"
],
inwardIssue: [
key: issueKey
],
outwardIssue: [
key: newIssueKey
]
])
.asObject(Map)
if (linkResult.status == 201) {
println "Issue ${newIssueKey} created and linked to ${issueKey} successfully."
// Copy attachments
(issue.fields.attachment as List<Map<String, String>>).each { attachment ->
def attId = attachment.id
def attResponse = Unirest.get("/rest/api/2/attachment/${attId}").asObject(Map)
def downloadUrl = attResponse.body.content
def readFileResp = Unirest.get(downloadUrl).asBinary()
def response = Unirest.post("/rest/api/2/issue/${newIssueKey}/attachments")
.header("Accept", "application/json")
.header("X-Atlassian-Token", "nocheck")
.field("file", readFileResp.body, attachment.filename.toString())
.asObject(Map)
if (response.status != 200) {
println "Failed to copy attachment ${attachment.filename} to ${newIssueKey}: ${response.body}"
}
}
} else {
println "Failed to link issue ${newIssueKey} to ${issueKey}: ${linkResult.body}"
}
} else {
println "Failed to create issue in ${targetProjectKey}: ${createResult.status}"
println "Response body: ${createResult.body}"
}
} else {
println "Failed to retrieve issue types: ${issueTypesResponse.status}"
}
} else { println "Issue ${issueKey} does not meet the criteria for request type and impact." } } else { println "Issue ${issueKey} is not in the source project ${sourceProjectKey}." }
import groovy.json.JsonSlurper
def sourceProjectKey = "JP" def targetProjectKey = "ITSAMPLE" def issueTypeNameToCheck = "Service request"
def issueKey = issue.key
// Check if the issue is in the source project if (issue.fields.project.key == sourceProjectKey) { def summary = issue.fields.summary def description = issue.fields.description def reporter = issue.fields.reporter def changeType = issue.fields.customfield_10005 def requestType = issue.fields.customfield_10010?.requestType?.name // Corrected reference def impact = issue.fields.customfield_10004?.value // Corrected reference
} else { println "Issue ${issueKey} is not in the source project ${sourceProjectKey}." }