Note
We've packed up and moved from Confluence to Discourse to bring you a better, more interactive space. Out of courtesy we didn't migrate your user account so - you will have to signup again
The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe
Here is an example for ticket 5082
This is the Remote replica for that ticket and Outgoing Script below that.
Remote Replica
if (issue.status?.name == "closed") return;
issue.key = replica.key
//issue.organization = replica.location_name
def locationToOrg = [
//"Santa Marta International Terminal (smit)" : "361142949531",
"Santa Marta International Terminal (smit)" : "361142949531",
// "Advent Intermodal Solutions (emod)" : "361145089832",
"Advent Intermodal" :"361145089832",
//"Matson Navigation" : "361082465291",
"Matson Navigation" : "361234218192",
"Seattle - Main (sea)" : "361082465291",
"Bethlehem" : "361142948111",
"Buffalo" : "361142948111",
"Chambersburg" : "361142948131",
"Detroit" : "361142948151",
"East St Louis" : "361142948171",
"Evansville" : "361142948211",
"Fairburn" : "361142948211",
"Indianapolis" : "361142948231",
"Louisville (LOU)" : "361142948271",
"Memphis" : "361142948291",
"Nashville" : "361142948311",
"North Bergen" : "361142948351",
"NWOH" : "361142948371",
"Philadelphia" : "361142948391",
"Savannah" : "361142948451",
"South Kearny" : "361142948471",
"Springfield" : "361142948491",
"Syracuse" : "361142948511",
"Tacoma Terminal (tac)" : "361142948511",
"Tampa" : "361142948531",
"Winterhaven" : "361142948591",
"Worcester (csxw)" : "361142948611",
"Port San Diego" : "361142948651",
"Freeport (fpo)" : "361142948671",
"Guayaquil (gye)" : "361142948691",
"Gulfport (gpt)" : "361142948711",
"Port Everglades (pef)" : "361142948751",
"Westlake Village" : "361142948811",
"Port of Wilmington (dwil)" : "361142948831",
"Portroe" : "361142948851",
"DRS - Philadelphia" : "361142948871",
"DRS/Tioga - Philadelphia" : "361142948891",
"Florida International Terminal (fit)" : "361142948911",
"Freightliner - Birmingham Terminal (bift)" : "361142948951",
"Freightliner - Bristol Railport" : "361142948971",
"Freightliner - Cleveland Terminal" : "361142949011",
"Freightliner - Coatbridge Railport" : "361142949031",
"Freightliner - Corporate" : "361142949051",
"Freightliner - Daventry" : "361142949071",
"Freightliner - Ditton" : "361142949091",
"Freightliner - Leeds Terminal" : "361142949111",
"Freightliner - Liverpool Terminal" : "361142949131",
"Freightliner - Manchester Terminal" : "361142949151",
"Freightliner - Scunthorpe" : "361142949171",
"Freightliner - Southampton" : "361142949191",
"Freightliner - Thamesport Terminal" : "361142949191",
"Southhampton" : "361142949191",
"Freightliner - Thamesport" : "361142949211",
"Freightliner - Tilbury Ramp" : "361142949231",
"Kingston Wharves Ltd (kwl)" : "361142949251",
"Koniambo Nickel SAS (kns)" : "361142949271",
"Little Ferry" : "361142949291",
"Luka Koper (kop)" : "361142949291",
//"Conley Terminal (mct)" : "361142949311",
"Massport-Conley Terminal" : "361142949311",
"Fergusson Container Terminal" : "361142949331",
"New Orleans" : "361142949351",
"New Orleans Terminal (nol)" : "361142949351",
"POMTOC" : "361142949371",
"Port Everglades Terminal" : "361145090012",
"Port Everglades Terminal (pet)" : "361142949391",
//"Port Lafito Haiti (plh)" : "361142949411",
"Port Lafito, Haiti" :"361142949411",
"North Intermodal Rail Yard (nim)" : "361142949451",
"PSA Halifax (hal)" : "361142949491",
"Red Hook Container Terminal (red)" : "361142949511",
"Santa Marta International Terminal (smit)" : "361142949531",
"SCIP - Dillon (ipd)" : "361142949551",
"SCPA - North Charleston Terminal (nit)" : "361142949571",
"Wando Welch Terminal (wwt)" : "361142949591",
"Blount Island Terminal" : "361142949611",
"Jacksonville Blount Island (bij)" : "361142949611",
"SSA Atlantic - Jacksonville Blount Island (bij)" : "361142949611",
"SSA Marine - SLC" : "361142949631",
"Manzanillo (zlo)" : "361142949651",
"SSA Mexico - Manzanillo (zlo)" : "361142949651",
"SSA Panama - Colon (mit)" : "361142949671",
"SSA SV International Chile Limitada" : "361142949691",
"B63" : "361142949711",
"C60 " : "361142949731",
"Matson Tacoma (TAM)" : "361142949751",
"SSAT - Matson Tacoma (TAM)" : "361142949751",
//"Oakland International Container Terminal (oict)" : "361142949771",
//"PCT" : "361142949791",
"Pacific Maritime Services - PMS/PCT (Long Beach, CA)": "361142949791",
//"SSAT - Oakland International Container Terminal (oict)" : "361142949771",
"SSA Terminals - Oakland (OICT) - Berth 59": "361142949771",
//"SSAT - PCT" : "361142949791",
"SSAT Pier A (Long Beach, CA)":"361142949791",
"SSAT - Terminal 5 (T5)" : "361142949811",
"Terminal 18 (t18)" : "361142949831",
"Terminal 25/30 (t30)" : "361142949851",
"Terminal A (pa)" : "361142949871",
"SSIT - Vietnam" : "361142949891",
"STE - Alameda (sta)" : "361142949911",
"Carson (stl)" : "361142949951",
//"STE - Carson (stl)" : "361142949951",
"Carson (stl)" : "361142949951",
"French Camp (stf)" : "361142949971",
"STE - French Camp (stf)" : "361142949971",
"STE - Middle Road" : "361142949991",
"Oakland (sto)" : "361142950011",
"STE - Oakland (sto)" : "361142950011",
"STE - Tukwila (sts)" : "361142950031",
"Tukwila (sts)" : "361142950031",
"Vale Nouvelle Caledonie" : "361142950031",
"STE - Wilmington (stw)" : "361142950051",
"Wilmington (stw)" : "361142950051",
"STI - San Antonio Terminal Internacional (sai)" : "361142950071",
"SVTI - San Vicente Terminal Internacional" : "361142950091",
"Terminal 54/55 (b54)" : "361142950111",
"Anchorage Office/Terminal (anc)" : "361142950171",
"San Juan Administrative Office (ssl)" : "361142950211",
"Trapac LA" : "361142950291",
"Tuxpan Terminal (tpt)" : "361142950311",
"YTI - Oakland" : "361142950351",
"Advent Intermodal Solutions (emod)" : "361145089832",
"Baltic Container Terminal (bct)" : "361145089852",
"Barranquilla Container Terminal - (bitco)" : "361145089872",
"BNSF (ssih) South Seattle Intermodal Facility" : "361145089932",
"CN Headquarters" : "361145089972",
"Crowley - San Juan (sjc)" : "361145090032",
"Portsmouth" : "361145090052",
"Main Office Jacksonville" : "361145090072",
"BNSF - Logistics Park Chicago (lpc)" : "361159557252",
"Freightliner - Doncaster Railport" : "361174665391",
"Freightliner - Teesport" : "361174665931",
"Felixstowe" : "361177035652",
"Freightliner - Hams Hall" : "361177035772",
"Bessemer Terminal" : "361177578311",
"Bedford Park" : "361177583691",
"Cincinnati" : "361177584291",
"Cleveland" : "361177585351",
"Columbus (colm)" : "361177586711",
"Jacksonville" : "361177593511",
"Charlotte" : "361179834732",
"Charleston" : "361179835432",
"Chicago 59th Street" : "361179837652",
"BNSF (sig) Seattle International Gateway" : "361145089912",
"BNSF Railway Main Office (BN01)" : "361179865332",
"Groupe Noumea Port (gnp)" : "361180142931",
"Gearbulk - Pasir Gudang (atm) ZD only" : "361182010311",
"Gearbulk - Port Manatee (pmtf)" : "361182016391",
"Batumi International Container Terminal (bict)" : "361182037551",
"Gearbulk - Lake Charles (lcct)" : "361184195972",
"Talleyrand (jac)" : "361145089992",
"Blount Island Terminal" : "361142950191"
]
def orgID = locationToOrg[replica.location_name]
//throw new Exception("orgID = ${orgID.class} ${orgID}")
issue.organization_id = orgID
//issue.customFields."Tideworks Applications".value = replica.tideworks_application
issue.customFields."Tideworks Applications".value = replica.product_name
def productMap = [
"Tideworks Intermodal Pro" : "intermodal_pro",
"Mainsail" : "mainsail",
"Tideworks Mainsail":"mainsail",
"Spinnaker" : "spinnaker",
"Traffic Control" : "traffic_control",
"EDI Porter" : "edi_porter",
"Forecast" : "forecast_",
"Terminal View" : "terminal_view",
"GateVision" : "gatevision",
"Insight" : "insight",
"Mainsail Billing" : "mainsail_billing",
"Scale Weight Reader" : "scale_weight_reader",
"System Integration Module (SIM)" : "sim",
"Buoy" : "buoy",
"Zendesk" : "zendesk",
]
def tideworks_appplication = productMap[replica.tideworks_application] ?: replica.tideworks_application
//def productName = productMap[replica.product_name] ?: replica.product_name
//issue.customFields."Tideworks Applications".value.value = "sim" //productName // commented out because this line is only blanking out the application field
if (replica.priority == "Critical") {
issue.customFields."Critical"?.value = true
}
def priorityMapping = [
// remote side priority <-> local side priority
"Critical" : "urgent",
"Important" : "high",
"Normal" : "normal",
"Informational" : "low"
]
def priorityName = priorityMapping[replica.priority?.name] ?: "normal" // set default priority in case the proper urgency could not be found
issue.priority = nodeHelper.getPriority(priorityName) //priorityName)
//issue.status = replica.state
//issue.assignee = replica.assignee
//throw new Exception("reporter: ${nodeHelper.getUser(replica.caller)}")
if (replica.caller)
issue.reporter = nodeHelper.getUserByEmail(replica.caller.toLowerCase())
issue.summary = replica.summary
//issue.customerCase.short_description =replica.subject
issue.description = replica.description ?: "No description"
//issue.labels = replica.labels
issue.attachments = attachmentHelper.mergeAttachments(issue, replica)
/*issue.comments += replica.addedComments.collect{ comment ->
comment.executor = nodeHelper.getUserByEmail(comment.author?.email?.toLowerCase())
def body = comment.body
comment.body = body.replaceAll("\\[code\\]", "").replaceAll("\\[/code\\]", "")
comment
}*/
issue.comments += replica.addedComments.collect{ comment ->
comment.executor = nodeHelper.getUserByEmail(comment.author?.email?.toLowerCase() ?: comment.author?.username?.toLowerCase())
comment.body = comment.body.replaceAll("\\[code\\]", "").replaceAll("\\[/code\\]", "")
if(comment.executor == null){
comment.body = "Comment from servicenow by "+comment.author?.username + "\n:" + comment.body
}
comment
}
//issue.comments += replica.closenotes
//issue.customFields."Tideworks Applications".value = replica.product_name
issue.customFields."Resolution Type".value = replica.close_code
issue.customFields."Triage Item"?.value = replica.u_jira_issue
issue.customFields."SN Incident"?.value = replica.incident
issue.customFields."Affected Version".value = replica.product_version
issue.customFields."SN Correlation Number".value = replica.number
//issue.customFields.Resolution_Code = "Select One"
//issue.customFields."CF Name".value = replica.customFields."CF Name".value
//Receive a Custom Field value
//issue.customFields."CF Name".value = replica.customFields."CF Name".value
if ((issue.status != "solved") && (issue.status != "closed")) {
def statusMap = [
"New" : "new",
"Open" : "open",
"Awaiting Info" : "pending",
"Solution Proposed" : "solved",
"Closed" : "closed"
]
//issue.status = "Awaiting Info" //(statusMapping[replica.state] ?: "New")
def remoteStatusName = replica.state
if ((remoteStatusName == "Solution Proposed") || (remoteStatusName == "Closed")) {
def addComment = "IT has concluded work on " + replica.number + ".\n"
addComment += "Resolution details: \"" + replica.close_code + "\" " + replica.close_notes
//issue.comments += addComment
}
else {
issue.setStatus(statusMap[remoteStatusName] ?: remoteStatusName)
}
}