Preview:
info "Ticket ID: " + tktid;

// Step 1: Get the Desk ticket
getTicket = zoho.desk.getRecordById("807258170","tickets",tktid);
ticketData = getTicket.get("statusType");

// Step 2: Fetch matching record from Zoho Creator using TKT_Desk_ID
tktresp = invokeurl
[
	url :"https://creatorapp.zoho.com/api/v2/support729/safe-guard/report/All_Service_Requests?criteria=(TKT_Desk_ID==" + tktid + ")"
	type :GET
	connection:"creator"
];
info tktresp;

// Step 3: Extract Creator record ID from the response
if (tktresp.containsKey("data") && tktresp.get("data").size() > 0)
{
    record = tktresp.get("data").get(0);
    recordID = record.get("ID").toLong(); // Ensure it's BIGINT
    info "Record ID to update: " + recordID;

    // Step 4: Prepare and send update
    updateMap = Map();
    optionalMap = Map();
    updateMap.put("Ticket_Status", ticketData);

    updateResp = zoho.creator.updateRecord("support729", "safe-guard", "All_Service_Requests", recordID, updateMap, optionalMap, "creator");
    info "Update response: " + updateResp.toString();
}
else
{
    info "No matching record found in Creator for Desk Ticket ID: " + tktid;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter