Modules

Functions

#

fetch(page, per_page, sort_by, sort_order) → {array}

Fetch Records

Parameters:
Name Type Attributes Description
page any <optional>

page number

per_page any <optional>

records per page

sort_by any <optional>

API name of field upon which records must be sorted

sort_order any <optional>

asc - ascending order; desc - descending order

Leads object array

array
Examples

FetchCopycopied

var leads = ZDK.Apps.CRM.Leads.fetch();
leads[0].Last_Name;

Fetch using page numberCopycopied

var leads = ZDK.Apps.CRM.Leads.fetch(2);
leads[0].Last_Name;

Fetch using page number & no. of records per pageCopycopied

var leads = ZDK.Apps.CRM.Leads.fetch(2, 20);
leads[0].Last_Name;

Fetch using page number, no. of records, sort by field, and sort orderCopycopied

var leads = ZDK.Apps.CRM.Leads.fetch(2, 20 ,"Last_Name", "desc");
leads[0].Last_Name;

#

fetchById(id) → {Leads}

Fetch Record By Id

Parameters:
Name Type Description
id String

record_id

object

Leads
Example

SampleCopycopied

var lead = ZDK.Apps.CRM.Leads.fetchById("423383000005261048");
lead.Last_Name;

#

create(arrayOfObjects) → {array}

Create Records
Line_Items, Pricing_Model, and Participants will be available inside the Models of their respective modules (ZDK.Apps.CRM.Invoices.Models.Line_Items)
For each picklist field there will be a element with the field name under the respective module's Models

Parameters:
Name Type Description
arrayOfObjects Array.<Leads>

leads object array or a single object

CRMResponses object array

array
Examples

Create Multiple RecordsCopycopied

var lead1 = new ZDK.Apps.CRM.Leads.Models.Leads();
lead1.Last_Name = "first Lead";
var lead2 = new ZDK.Apps.CRM.Leads.Models.Leads();
lead2.Last_Name = "second Lead";
var leads = [lead1, lead2];
var response = ZDK.Apps.CRM.Leads.create(leads);

Create RecordCopycopied

var lead = new ZDK.Apps.CRM.Leads.Models.Leads();
lead.Last_Name = "James";
lead.Lead_Status = ZDK.Apps.CRM.Leads.Models.Lead_StatusPicklist.CONTACTED;
var response = ZDK.Apps.CRM.Leads.create(lead);

Create Record in Inventory ModulesCopycopied

var invoice = new ZDK.Apps.CRM.Invoices.Models.Invoices();
invoice.Subject = "testing2";
invoice.Account_Name_Lookup_Id = "2000000136022";
var line_item = new ZDK.Apps.CRM.Invoices.Models.Line_Items();
var product = ZDK.Apps.CRM.Products.fetchById("2000000136027");
line_item.product(product);
line_item.quantity=3.0;
var line_items = new Array();
line_items.push(line_item);
invoice.Product_Details = line_items;
var response = ZDK.Apps.CRM.Invoices.create(invoice);

Create Record in Price_Books ModuleCopycopied

var book = new ZDK.Apps.CRM.Price_Books.Models.Price_Books();
book.Price_Book_Name = "test";
book.Pricing_Model = ZDK.Apps.CRM.Price_Books.Models.Pricing_ModelPicklist.FLAT;
var pricing_detail = new ZDK.Apps.CRM.Price_Books.Models.Pricing_Details();
pricing_detail.from_range = 10;
pricing_detail.to_range = 100;
pricing_detail.discount = 5;
var pricing_detail2 = new ZDK.Apps.CRM.Price_Books.Models.Pricing_Details();
pricing_detail2.from_range = 1000;
pricing_detail2.to_range = 2000;
pricing_detail2.discount = 10;
var details = new Array();
details.push(pricing_detail);
details.push(pricing_detail2);
book.Pricing_Details = details;
var response = ZDK.Apps.CRM.Price_Books.create(book);

Create Record in Events ModuleCopycopied

var my_event = new ZDK.Apps.CRM.Events.Models.Events();
my_event.Event_Title = "testing";
my_event.Start_DateTime = "2020-10-22T21:00:00+05:45";
my_event.End_DateTime = "2020-10-24T21:00:00+06:45";
my_event.Description = "test";
my_event.Currency = "USD";
var participant = new ZDK.Apps.CRM.Events.Models.Participants();
participant.participant= "423383000004997180";
participant.type= "lead";
var participants = new Array();
participants.push(participant);
my_event.Participants = participants;
var response = ZDK.Apps.CRM.Events.create(my_event);

Create Record in Related Records ModuleCopycopied

var note = new ZDK.Apps.CRM.Notes.Models.Notes()
note.Note_Content = "create test";
note.Parent_Id_Lookup_Id = "2000000069181";
note.$se_module = "Leads";
var response = ZDK.Apps.CRM.Notes.create(note);

#

update(arrayOfObjects) → {array}

Update Records

Parameters:
Name Type Description
arrayOfObjects Array.<Leads>

leads object array or a single object

CRMResponses object array

array
Examples

Update Multiple RecordsCopycopied

var lead1 = ZDK.Apps.CRM.Leads.fetchById("423383000005261048");
lead1.Last_Name = "Updated Name";
var lead2 = ZDK.Apps.CRM.Leads.fetchById("423383000005267521");
lead2.Last_Name = "Updated Name2";
var leads = [lead1, lead2];
var response = ZDK.Apps.CRM.Leads.update(leads);

Update RecordCopycopied

var lead = ZDK.Apps.CRM.Leads.fetchById("423383000005261048");
lead.Last_Name = "Updated Name";
var response = ZDK.Apps.CRM.Leads.update(lead);

#

updateById(arrayOfObjects, record_id) → {CRMResponses}

Update Record By Id

Parameters:
Name Type Description
arrayOfObjects Leads

leads object array or a single object

record_id String

record_id

object

CRMResponses
Example

SampleCopycopied

var lead = ZDK.Apps.CRM.Leads.fetchById("423383000005261048");
lead.Last_Name = "Updated Name";
var response = ZDK.Apps.CRM.Leads.updateById(lead, "423383000005261048");

#

upsert(arrayOfObjects) → {array}

Upsert Records

Parameters:
Name Type Description
arrayOfObjects Array.<Leads>

leads object array or a single object

CRMResponses object array

array
Examples

Upsert RecordsCopycopied

var lead1 = ZDK.Apps.CRM.Leads.fetchById("423383000005261048");
lead1.Last_Name = "Updated Name";
var lead2 = ZDK.Apps.CRM.Leads.fetchById("423383000005267521");
lead2.Last_Name = "Updated Name2";
var leads = [lead1, lead2];
var response = ZDK.Apps.CRM.Leads.upsert(leads);

Upsert RecordCopycopied

var lead = new ZDK.Apps.CRM.Leads.Models.Leads();
lead.Last_Name = "Updated Name";
var response = ZDK.Apps.CRM.Leads.upsert(lead);

#

deleteByIds(ids) → {array}

Delete Record By Ids

Parameters:
Name Type Description
ids Array.<String>

array of record ids

CRMResponses object array

array
Example

SampleCopycopied

var response = ZDK.Apps.CRM.Leads.deleteByIds(["423383000005261048", "423383000005261076"]);

#

fetchDeletedRecords() → {array}

Fetch Deleted Records

Deleted_Records object array

array
Example

SampleCopycopied

var deletedRecords = ZDK.Apps.CRM.Leads.fetchDeletedRecords();

#

convert(convertLeads, id) → {array}

Convert Leads

Parameters:
Name Type Description
convertLeads ConvertLeads

ConvertLeads object

id String

record id

ConvertLeadsResponse object array

array
Example

SampleCopycopied

var convertLead = new ZDK.Apps.CRM.Leads.Models.ConvertLeads();
convertLead.Accounts = "4312588000000296007";
var deal = new ZDK.Apps.CRM.Deals.Models.Deals();
deal.Deal_Name = "Convert";
deal.Closing_Date = "2020-11-20";
deal.Stage = ZDK.Apps.CRM.Deals.Models.StagePicklist.CLOSED_WON;
deal.Amount = 56.6
convertLead.Deals = deal;
var response = ZDK.Apps.CRM.Leads.convert(convertLead, "4312588000000846005");

#

searchByCriteria(criteria) → {array}

Search Records By Criteria

Parameters:
Name Type Description
criteria String

search criteria

Leads object array

array
Example

SampleCopycopied

var leads = ZDK.Apps.CRM.Leads.searchByCriteria("((Last_Name:equals:Burns%5C%2CB)and(First_Name:starts_with:M))");

#

searchByEmail(email) → {array}

Search Records By Email

Parameters:
Name Type Description
email String

email

Leads object array

array
Example

SampleCopycopied

var leads = ZDK.Apps.CRM.Leads.searchByEmail("newcrmapi@zoho.com");

#

searchByPhone(phone) → {array}

Search Records By Phone

Parameters:
Name Type Description
phone String

phone

Leads object array

array
Example

SampleCopycopied

var leads = ZDK.Apps.CRM.Leads.searchByPhone("98883434559");

#

searchByWord(word) → {array}

Search Records By Word

Parameters:
Name Type Description
word String

word

Leads object array

array
Example

SampleCopycopied

var leads = ZDK.Apps.CRM.Leads.searchByWord("abc");

#

fetchRelatedRecords(id, related_list_api_name) → {array}

Fetch Related Records

Parameters:
Name Type Description
id String

record id

related_list_api_name String

related_list_api_name

Related_Records object array

array
Example

SampleCopycopied

var related_records = ZDK.Apps.CRM.Leads.fetchRelatedRecords("4312588000000381015", "Notes");
for(var i=0; i< related_records.length; i++){
      log(related_records[i]);
}

#

delinkRelatedRecords(id, related_list_api_name, array_of_related_record_ids) → {array}

Delink Related Records

Parameters:
Name Type Description
id String

record id

related_list_api_name String

related_list_api_name

array_of_related_record_ids Array.<String>

array of record ids

CRMResponses object array

array
Example

SampleCopycopied

var array_of_related_record_ids = ["423383000300012916", "423383000002015945"];
var response = ZDK.Apps.CRM.Leads.delinkRelatedRecords("423383000000015966", "Notes", array_of_related_record_ids);

#

delinkRelatedRecord(id, related_list_api_name, related_record_id) → {array}

Delink Related Record

Parameters:
Name Type Description
id String

record id

related_list_api_name String

related_list_api_name

related_record_id String

related record id

CRMResponses object array

array
Example

SampleCopycopied

var response = ZDK.Apps.CRM.Leads.delinkRelatedRecord("423383000000015966", "Notes", "423383000002015945");

#

updateRelatedRecords(related_record_object, record_id, related_list_api_name, related_record_id) → {array}

Update Related Records

Parameters:
Name Type Description
related_record_object Related_Records

related record

record_id String

record id

related_list_api_name String

related_list_api_name

related_record_id String

related record id

CRMResponses object array

array
Example

SampleCopycopied

var related_record_object = ZDK.Apps.CRM.Leads.fetchRelatedRecords("423383000000015966", "Notes");
related_record_object[0].Note_Content = "updated content";
var response = ZDK.Apps.CRM.Leads.updateRelatedRecords(related_record_object[0],  "423383000000015966","Notes", related_record_object[0].id);

#

fetchBlueprint(record_id) → {Blueprint}

Fetch Blueprint

Parameters:
Name Type Description
record_id String

record id

Blueprint array

Blueprint
Example

SampleCopycopied

var blueprint = ZDK.Apps.CRM.Leads.fetchBlueprint("2000000069181");

#

addTagsToRecord(record_id, array_of_tag_names) → {CRMResponses}

Add Tags to Record

Parameters:
Name Type Description
record_id String

record id

array_of_tag_names Array.<String>

array_of_tag_names

object

CRMResponses
Example

SampleCopycopied

var array_of_tag_names = ["important", "contacted"];
var response = ZDK.Apps.CRM.Leads.addTagsToRecord("735220000001193166", array_of_tag_names);

#

addTagsToRecords(array_of_tag_names, record_ids) → {array}

Add Tags to Records

Parameters:
Name Type Description
array_of_tag_names Array.<String>

array_of_tag_names

record_ids Array.<String>

record ids array

CRMResponses object array

array
Example

SampleCopycopied

var array_of_tag_names = ["important", "contacted"];
var record_ids = ["423383000005267523", "423383000005267521"];
var response = ZDK.Apps.CRM.Leads.addTagsToRecords(array_of_tag_names, record_ids);

#

removeTagsToRecord(record_id, array_of_tag_names) → {CRMResponses}

Remove Tags from Record

Parameters:
Name Type Description
record_id String

record id

array_of_tag_names Array.<String>

array_of_tag_names

object

CRMResponses
Example

SampleCopycopied

var array_of_tag_names = ["important", "contacted"];
var response = ZDK.Apps.CRM.Leads.removeTagsToRecord("735220000001193166", array_of_tag_names);

#

removeTagsToRecords(array_of_tag_names, record_ids) → {array}

Remove Tags from Records

Parameters:
Name Type Description
array_of_tag_names Array.<String>

array_of_tag_names

record_ids Array.<String>

record ids array

CRMResponses object array

array
Example

SampleCopycopied

var tags = ["important", "contacted"];
var ids = ["423383000005267523", "423383000005267521"];
var response = ZDK.Apps.CRM.Leads.removeTagsToRecords(tags, ids);

#

sendMail(mail_object, record_id) → {array}

Send Mail

Parameters:
Name Type Description
mail_object Mail

mail object

record_id Array.<String>

record id

CRMResponses object array

array
Example

SampleCopycopied

var mail = new ZDK.Apps.CRM.__Actions.Models.Mail();
mail.from = {"user_name": "james", "email": "james.cooper@zoho.com"};
mail.to = [ {"user_name": "john", "email": "john.carlton@zoho.com" }];
mail.subject = "Mail subject";
mail.content = "Content of the mail";
mail.mail_format = "text";
var response = ZDK.Apps.CRM.Leads.sendMail(mail, "423383000000015966");

#

approveRecord(record_id, action, comment) → {CRMResponses}

Approve Records

Parameters:
Name Type Description
record_id String

record id

action String

approve|delegate|reject

comment String

comment

object

CRMResponses
Example

Approve RecordsCopycopied

var approval_response = ZDK.Apps.CRM.Leads.approveRecord("423383000005261048", "approve", "approval comment");
log(approval_response.status);

#

getFeatureInfo(ids, features) → {array}

Fetch Feature Info

Parameters:
Name Type Description
ids Array.<String>

record ids (at max only 100 record ids are allowed)

features Array.<String>

blocked_emails, consecutive_negative_emails (at max only 5 features are allowed)

FeatureInfo object array

array
Example

SampleCopycopied

var response = ZDK.Apps.CRM.Leads.getFeatureInfo(["111117000000,111117000001,111117000002"], ["blocked_emails,consecutive_negative_emails"]);
 for(var i=0; i < response[0]._features_info.length; i++) {
	 log(response[0]._features_info[i]);
}