Skip to content

Instantly share code, notes, and snippets.

@CubeYogi
CubeYogi / update_crm_lead_phone_num_with_country_code_v2.js
Created December 15, 2017 10:06
Zoho CRM Custom Function For Leads Phone Number Country Code Updation
/*
* Zoho CRM Custom Function For Leads Phone Number Country Code Updation
* This Custom Function is for the Leads module in Zoho CRM.
* This code is in Deluge scripting language.
* This is used to check an incoming Leads to see if their phone num has the country dialing code.
* If not, then this code would fetch the appropriate code based on the 'Country' field value from the Leads.
* Then this would update the 'Phone' field in the CRM Leads to reflect the new number which has the country code prefixed.
*
* Note : We added a JS extension to this file so you could see some markup! :) But this is a Deluge file. Nothing Javascript about it! ;)
*
@CubeYogi
CubeYogi / zoho.crm.searchRecords() when criteria contains a pipe character.js
Created May 4, 2018 10:41
Zoho CRM Snippet : removes pipe character from criteria during zoho.crm.searchRecords()
/*** removes pipe character from criteria during zoho.crm.searchRecords() ***/
lead_name = "|Cube | Yogi";
/** removes Pipeline character from criteria **/
/** Case 1 for | Yogi**/
lead_name = lead_name.replaceAll("\| ", "");
/** Case 2 for |Cube **/
lead_name = lead_name.replaceAll("\|", "");
if(lead_name != null && lead_name != "null" && lead_name.length() > 0)
{
/** Search Record Function **/
@CubeYogi
CubeYogi / upload_attachment_to_contact_in_zoho_crm.js
Created August 25, 2018 09:20
Upload attachment to Contacts in Zoho CRM through Zoho API
$date = new DateTime();
//Get the time stamp from the variable
$current_time_long= $date->getTimestamp();
/
//Read the content from the pdf
$pdfName = 'filename';
$file_data = file_get_contents(filename);
//Declare a variable for enctype for sending the file to creator
$KLineEnd = "\r\n";
$kDoubleHypen = "--";
//Replace contact module API name here
contact_module_api_name = "contacts";
//Replace lead module API name here
leads_module_api_name = "leads";
//Replace newly created module API name here
duplicate_module_api_name = "duplicates_within_contacts_and_leads";
//Replace contact module email field API name here
contact_email_field_api_name = "email";
//Replace contact module id field API name here
contact_id_field_api_name = "id";
//Replace the module API name
contact_module_name = "Contacts";
deals_module_name = "Deals";
//Replace the field API name
contact_full_name_field_name = "Full_Name";
contact_description_field_name = "Description";
contact_lead_source_field_name = "Lead_Source";
contact_account_field_name = "Account_Name";
common_id_field_name = "id";
contact_owner_field_name = "Owner";
//get the Url from url field
url_link = input.Url;
//remove the html tags and get the url
final_url = url_link.getSuffix("_blank\">");
final_url = final_url.getPrefix("</a>");
//add the Url into image field
input.photo = "<img src="\""+final_url+"\"/">";
//Replace the image field Link name on photo
input.photo = "<img src="\"https://www."google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png\"/>";
//create a new list
send_parameter_list = List();
//add the parameters need to pass
send_parameter_list.add(input.Name);
//open form to display user details in a popup
//Replace the page 2 url here after #
//Replace the parameter after ?
openUrl("#Page:Login?employee_id=" + send_parameter_list,"same window","height=500px,width=1000px");
//Replace the Parameter name in the red shaded code
<div elName='zc-component' formLinkName='Login' params='zc_Header=true&zc_SuccMsg=Data Added Sucessfully!&zc_SubmitVal=Submit&zc_ResetVal=Reset&employee_id=<%=employee_id%>'>Loading Form...</div>
//Replace the module name with correct API name
product_module_name = "Products";
deals_module_name = "Deals";
//Replace the field API name correctly
product_unit_price_field_name = "Unit_Price";
deals_amount_field_name = "Amount";
//Fetches all product related to a deal from its related list
product_entries = zoho.crm.getRelatedRecords(product_module_name, deals_module_name, deal_id);
//Assign initial value of variable deal_amount as 0
deal_amount = 0;