Deluge script issue : Mismatch of data type expression. Expected BIGINT but found STRING

Deluge script issue : Mismatch of data type expression. Expected BIGINT but found STRING

I'm building a Zoho Creator form to take inputs for Email, Bootcamp Name, and Tag. If a record with the same Email + Bootcamp exists in a custom module (bootcampattendence), I want to update it by adding a new tag. If it doesn’t exist, I want to create the record and add the tag.

Even though the record is created or found successfully, when I try to update the tag, I get an error:
Mismatch of data type expression. Expected BIGINT but found STRING

I’m using zoho.crm.updateRecord("bootcampattendence", recordId, updateMap); where recordId is .toLong() converted.”

BELOW IS MY CODE:

// Capture inputs from the form
input.email = input.email;
bootcamp = input.bootcampname;
tagName = input.tag;
// Step 1: Search for existing record
criteria = "(Email:equals:" + input.email + ") and (Bootcamp_Name:equals:" + bootcamp + ")";
searchResp = zoho.crm.searchRecords("bootcampattendence",criteria);
recordIdStr = "";
if(searchResp != null && searchResp.size() > 0)
{
// Record exists
recordIdStr = searchResp.get(0).get("id").toString();
info "Record found with ID: " + recordIdStr;
}
else
{
// Step 2: Create record
newRecord = Map();
newRecord.put("Email",input.email);
newRecord.put("Bootcamp_Name",bootcamp);
createResp = zoho.crm.createRecord("bootcampattendence",newRecord);
if(createResp.get("id") != null)
{
recordIdStr = createResp.get("id").toString();
info "New record created with ID: " + recordIdStr;
}
else
{
info "Record creation failed.";
}
}
// Step 3: Add Tag
if(recordIdStr != "")
{
recordId = recordIdStr.toLong();
// Required as updateRecord needs BIGINT
tagMap = list();
tagEntry = Map();
tagEntry.put("name",tagName);
tagMap.add(tagEntry);
updateMap = Map();
updateMap.put("Tag",tagMap);
updateResp = zoho.crm.updateRecord("bootcampattendence",recordId,updateMap);
info updateResp;
}
else
{
info "No record ID found to add tag.";
}