Here's a LEAD Module script to add a tag to the record if a duplicate record is present in the Contacts, based on the Lead email.
leadinfo = zoho.crm.getRecordById("Leads",leadid);
//fullname = leadinfo.get("Full_Name");
email = leadinfo.get("Email");
resp = zoho.crm.searchRecords("Contacts","(Email:equals:" + email + ")");
info "resp:" + resp;
info "size:" + resp.size();
if(resp.size() > 0)
{
update = zoho.crm.updateRecord("Leads",leadid,{"Contact_Check":true});
info update;
tags_list = List();
tag1 = Map();
tag1.put("name","IsContact");
tags_list.add(tag1);
ids = {leadid};
param = Map();
param.put("tags", tags_list);
param.put("ids",ids);
info "Param : "+param;
leadTagUpdate = invokeurl
[
url : "https://www.zohoapis.com/crm/v6/Leads/actions/add_tags"
type : POST
parameters: param + " "
connection: "crmcon"
];
info "Tag Update : " + leadTagUpdate;
}
Replace "crmcon" with the name of the connection.
Please add the scope, Scopes :ZohoCRM.modules.all, to the connection.