Skip to content

Updates to the overall project #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
77a321a
Add files via upload
georgeotj Mar 8, 2019
5dcf9f0
Update insertTasksMockaroo.py
georgeotj Mar 8, 2019
079f37e
Update upsertAccountsMockaroo.py
georgeotj Mar 8, 2019
ef2f1a9
Update upsertContactsMockaroo.py
georgeotj Mar 8, 2019
e45b3fe
Update upsertDealsMockaroo.py
georgeotj Mar 8, 2019
fb9a993
Update upsertLeadsMockaroo.py
georgeotj Mar 8, 2019
69ca513
Update upsertContactsMockaroo.py
georgeotj Mar 8, 2019
62334f8
Update credentials.py-example
georgeotj Mar 12, 2019
f7d1321
Create Total_Cost_of_Tradeshow.ds
georgeotj Mar 20, 2019
4ee6260
Updated format to increase clarity
georgeotj Mar 20, 2019
54e6ba3
Update Total_Cost_of_Tradeshow.ds
georgeotj Mar 20, 2019
9bdcc50
Create Trade_Show_ROI.ds
georgeotj Mar 20, 2019
dbfbd6d
Rename Deluge Functions/Custom Buttons/Total_Cost_of_Tradeshow.ds to …
georgeotj Mar 20, 2019
d4d1b30
Rename Deluge Functions/Custom Buttons/Trade_Show_ROI.ds to Deluge Fu…
georgeotj Mar 20, 2019
9c0098e
Rename Deluge Functions/Custom Buttons/convert_lead_from_quote_view.d…
georgeotj Mar 20, 2019
8bb7efb
Create Custom Function
georgeotj Mar 20, 2019
dcfdb6b
Delete Custom Function
georgeotj Mar 20, 2019
5cb1999
Create README.txt
georgeotj Mar 20, 2019
ded339a
Rename Deluge Functions/Total_Cost_of_Tradeshow.ds to Deluge Function…
georgeotj Mar 20, 2019
9c051d2
Rename Deluge Functions/Trade_Show_ROI.ds to Deluge Functions/Custom …
georgeotj Mar 20, 2019
fca48e5
Rename Deluge Functions/convert_lead_from_quote_view.ds to Deluge Fun…
georgeotj Mar 20, 2019
e2d4eb7
Create leadScoring.ds
georgeotj Mar 26, 2019
678f9f4
Update leadScoring.ds
georgeotj Mar 26, 2019
b562577
Update Trade_Show_ROI.ds
georgeotj Mar 27, 2019
88d9a9c
Update leadScoring.ds
georgeotj Mar 27, 2019
6ca22e3
Create Close_Junk_Lead_Tasks.ds
georgeotj Mar 28, 2019
3775444
Rename leadScoring.ds to Lead_Scoring.ds
georgeotj Mar 28, 2019
337edbd
Rename convert_lead_from_quote_view.ds to Convert_Lead_From_Quote_Vie…
georgeotj Mar 28, 2019
7cf63ac
Create Capturing_Sales_Region.ds
georgeotj Mar 28, 2019
8cd9871
Update README.md
georgeotj Mar 28, 2019
32c61f4
Update Close_Junk_Lead_Tasks.ds
georgeotj Mar 29, 2019
06e5789
Create Mass_Update_of_Child_Contacts.ds
georgeotj Mar 29, 2019
0e4a315
Create Generate_Total_Revenue_From_Deals
georgeotj Apr 1, 2019
aa55f51
Create Create_Projects_While_Winning_Potentials.ds
georgeotj Apr 2, 2019
303251a
Create Time_To_Close.ds
georgeotj Apr 2, 2019
502f4a9
Create Current_Value_In_Previous.ds
georgeotj May 1, 2019
0248573
Create Creare_CF_History_Record.ds
georgeotj May 1, 2019
877702e
Rename Creare_CF_History_Record.ds to Create_CF_History_Record.ds
georgeotj May 1, 2019
e54d9eb
Create Take_Current_CF_Add_To_Previous_CF.ds
georgeotj May 1, 2019
f80eeba
Update Create_CF_History_Record.ds
georgeotj May 3, 2019
6739e09
Update Create_CF_History_Record.ds
georgeotj May 6, 2019
595eecb
Create upsertSetMockaroo.py
georgeotj Aug 9, 2019
42cd394
Fixed formatting
georgeotj Aug 9, 2019
7a2e12f
Fixed formatting
georgeotj Aug 9, 2019
7159fb1
Fixed formatting
georgeotj Aug 9, 2019
0ea7dde
Update upsertSetMockaroo.py
georgeotj Aug 28, 2019
5f81aee
Update upsertSetMockaroo.py
georgeotj Sep 5, 2019
f2435f7
Update upsertSetMockaroo.py
georgeotj Sep 20, 2019
e0e4cc2
Update upsertSetMockaroo.py
georgeotj Sep 20, 2019
92bd668
Create convertLeadToProspect.ds
georgeotj Nov 1, 2019
de0a5ae
Rename convertLeadToProspect.ds to Convert_Lead_To_Prospect.ds
georgeotj Nov 1, 2019
756f6a8
Update Convert_Lead_To_Prospect.ds
georgeotj Nov 1, 2019
a1c5251
Create convert_record_to_other_module.ds
georgeotj Nov 4, 2019
d924224
Update convert_record_to_other_module.ds
georgeotj Nov 4, 2019
a0f3e41
Update convert_record_to_other_module.ds
georgeotj Nov 4, 2019
efc2ba0
Update convert_record_to_other_module.ds
georgeotj Nov 5, 2019
ead1eeb
Create iterate_through_multiselect_lookupfield.ds
georgeotj Dec 19, 2019
c8c0c4b
Create Creating_Sales_Order_For_Zoho_Books_From_Zoho_CRM.ds
georgeotj Feb 3, 2020
3f65fdd
Create Show_Related_Addresses_Of_Account.ds
georgeotj Feb 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Deluge Functions/Buttons/convert_record_to_other_module.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//Anything within curly brackets will need to be replaced to the correct module, field, or variable.

// This variable will be important to get the specific fields within the record.
rec = zoho.crm.getRecordById({module},{argumentId});

// These variables are used to simplify getting field information
name = rec.get("First_Name") + " " + rec.get("Last_Name");
totalWattage = rec.get("Wattage_Per_Panel") * rec.get("Number_of_Panels");

// A temporary map is created to store the data from the original record.
mp = Map();

// This if-statement verifies that the user has paid using a field. If the field is selected, it will return true and will
// allow you to convert the record. However, if the field is not selected it will give you an error.

if(rec.get("Has_Paid") == true)
{
// These statements follow the format mp.put({fieldInNewModule}, {fieldInOriginalModule});
// For example in the instructions below, the statement will put the value name from line 7
// into the keyword "Name". These keys are stored into the map and will then be used to create
// the record in line 37.

mp.put("Name",name);
mp.put("Email",rec.get("Email"));
mp.put("First_Name",rec.get("First_Name"));
mp.put("Last_Name",rec.get("Last_Name"));
mp.put("Phone",rec.get("Phone"));
mp.put("Mobile",rec.get("Mobile"));
mp.put("Email",rec.get("Email"));
mp.put("Installation_Address",rec.get("Installation_Address"));
mp.put("Installation_City",rec.get("Installation_City"));
mp.put("Installation_State",rec.get("Installation_State"));
mp.put("Installation_Zip_Code",rec.get("Installation_Zip_Code"));
mp.put("Number_of_Panels",rec.get("Number_of_Panels"));
mp.put("Wattage_Per_Panel",rec.get("Wattage_Per_Panel"));
mp.put("Installation_Zip_Code",rec.get("Installation_Zip_Code"));
mp.put("Total_Wattage",totalWattage.toString());
createClient = zoho.crm.createRecord("Clients",mp);
result = "Success!";

// If you would like to delete the record after it is converted you can uncomment out lines 43-45 by
// removing the double forward slash.
//Delete Record
//deleteRecordMap = Map();
//deleteRecordMap = {"module":"{module}","id":argumentId};
//deleteResp = zoho.crm.invokeConnector("crm.delete",deleteRecordMap);
}
else
{
result = "ERROR: Prospect has not paid or \"Has Paid\" field hasn't been updated. Please verify these requirements have been met.";
}
return result;
29 changes: 29 additions & 0 deletions Deluge Functions/Custom Functions/Capturing_Sales_Region.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
This folder will contain custom functions for Zoho CRM. These functions will have the following format

// Author: georgeotj
// Description: Based on a Lead's country, they will be marked to a specific region in their profile.
// Requirements: Custom field called "Region" in the Leads module inside the Address Information
// Arguments: leadId: Lead Id, country: Country, fieldToUpdate: Region

// Declare variables
countryList1 = {"united kingdom","uk","great britain","gb"};
countryList2 = {"united states","usa","us"};
countryList3 = {"argentina","bolivia","brazil","chile","colombia","ecuadar","guiana","guyana","mexico","paraguay"};
countryList4 = {"France","Belgium","Germany","Netherlands","Ireland","Israel","South Africa","Italy","United Arab Emirates","Spain"};
countryList5 = {"Singapore","China","Japan","Thailand","Vietnam","Malaysia","Mauritius","Hongkong","Maldives","Pakistan"};
countryMap = {"UK":countryList1,"US":countryList2,"SAMERICA":countryList3,"EMEA":countryList4,"APAC":countryList5};

countryMapkKey = countryMap.keys();
mailingRegion = "";

// Code
for each region in countryMapkKey
{
countryListValue = countryMap.get(region);
if(countryListValue.contains(country.toLowerCase()))
{
mailingRegion = region;
}
}
updateMap = {fieldToUpdate:mailingRegion};
updatedResponse = zoho.crm.updateRecord("Leads",leadId,updateMap);
19 changes: 19 additions & 0 deletions Deluge Functions/Custom Functions/Close_Junk_Lead_Tasks.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Author: georgeotj
// Description: There are many sources for lead generation within Zoho CRM. When you validate the leads during the nurturing process, a few leads will qualify as Junk. Even if you mark a lead as junk, the tasks associated with it will remain open. This function allows you to close tasks associated with junk leads.
// Requirements: No changes necessary for CRM.
// Arguments: LeadID: Lead Id, status: Lead Status

// Declare variables

// Code
if(leadStatus.contains("Junk"))
{
relatedTask = zoho.crm.getRelatedRecords("Tasks","Leads",leadId);
for each task in relatedTask
{
mapVariable = Map();
mapVariable.put("Status","Completed");
taskID = task.get("id");
updateTask = zoho.crm.updateRecord("Tasks",taskID,mapVariable);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ quote_map.put("Contact_Name",contact_ID);

// Update Quote with Account / Contact ID
resp = zoho.crm.updateRecord("Quotes",quote_ID,quote_map);
return "Success: Lead Converted";
return "Success: Lead Converted";
21 changes: 21 additions & 0 deletions Deluge Functions/Custom Functions/Convert_Lead_To_Prospect.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//Arguments: leadId = Lead ID
rec = zoho.crm.getRecordById("Leads1",leadId);
mp = Map();
// Get data from the Prospect record and make a Lead record
mp.put("First_Name",rec.get("First_Name"));
mp.put("Last_Name",rec.get("Last_Name"));
mp.put("Email",rec.get("Email"));
if(rec.get("Phone_Type") == "Mobile")
{
mp.put("Mobile",rec.get("Phone"));
}
else
{
mp.put("Phone",rec.get("Phone"));
}
createProspect = zoho.crm.createRecord("Leads",mp);
// Delete Prospect record
//deleteRecordMap = Map();
//deleteRecordMap = {"module":"Leads1","id":leadId};
//deleteResp = zoho.crm.invokeConnector("crm.delete",deleteRecordMap);
return rec;
40 changes: 40 additions & 0 deletions Deluge Functions/Custom Functions/Create_CF_History_Record.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Author: georgeotj
// Description: This script will allow you to create a new record to keep a history of the changes made to a specific custom field
// Requirements: Associated Module is Dealsd, Custom Module with fields Name (Single Line), Owner (Lookup), Updated From (Single Line), Updated To (Single line), Deal Associated (Lookup, Deals)
// Arguments: dealId Deal Id

// Declare variables
related = zoho.crm.getRelatedRecords("CF_Updated_History","Deals",dealId);
deal = zoho.crm.getRecordById("Deals",dealId);
currentClose = deal.get("Expected_Close_Date");
previousClose = deal.get("Previous_Close_Date");
dealName = deal.get("Deal_Name");
lastModified = deal.get("Modified_By");

//Code
// Try to create the lastEntry variable but if there's nothing available set it to today.
try
{
lastEntry = related.get(0).get("Created_Time");
}
catch (e)
{ lastEntry = today.toDate();
}
timeDif = days360(lastEntry,today);

//Create the record
if(currentClose != previousClose)
{
mp = Map();
mp.put("Updated_To",currentClose);
mp.put("Updated_From",previousClose);
mp.put("Deal_Associated",dealId);
mp.put("Name",dealName);
mp.put("Owner",lastModified);
mp.put("Days_Between_Changes",timeDif.toString());
createRec = zoho.crm.createRecord("Deal_CF_History",mp);
// Update fields in Deals Module
updatePrevMap = Map();
updatePrevMap.put("Previous_Close_Date",currentClose);
updatePrevious = zoho.crm.updateRecord("Deals",dealId,updatePrevMap);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
This folder will contain custom functions for Zoho CRM. These functions will have the following format

// Author: Zach Zivnuska
// Description: This function will automatically create a new Project whenever a deal is created.
// Requirements: Must have an active Zoho Projects account
// Arguments: N/A
// Notes: //In order to get your URL, you must replace the [portalId] with your organization's
//To get your portalId, follow the instructions below
//Go to Zoho Projects --> go to Setup --> Under 'Integration' click "Developer Space" in the page that opens,
//click on "Service Hooks" --> look at the URL's and you will see your organization's portalId.

// Declare variables
m = {"name":name};

// Code
response = invokeurl
[
url :"https://projectsapi.zoho.com/restapi/portal/[portalId]/projects/"
type :POST
parameters:m
connection:"zoho264"
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sOrderObj = zoho.crm.getRecordById("Sales_Orders", id);
crmSOProductLst = sOrderObj.get("Product_Details");
crmContactId = ifnull(sOrderObj.get("Contact_Name"),{"id", null}).get("id");
crmAccountId = ifnull(sOrderObj.get("Account_Name"),{"id", null}).get("id");
prodList=List();
for each product in crmSOProductLst
{
pId = product.get("product").get("id");
quantity = product.get("quantity");
listPrice = product.get("list_price").toDecimal();
zbPId = zoho.books.getRecords("Items", "668072369","zcrm_product_id="+pId).get("items").get(0).get("item_id");
prodmp = map();
prodmp.put("item_id",zbPId);
prodmp.put("rate",listPrice);
prodmp.put("quantity",quantity);
prodList.add(prodmp);
}
customerid = zoho.books.getRecords("Contacts", "668072369","zcrm_account_id="+crmAccountId).get("contacts").get(0).get("contact_id");
mp = map();
mp.put("customer_id",customerid);
mp.put("line_items",prodList);
mp.put("date",today);
mp.put("custom_fields", [{"label": "Third Party Cleaned", "value": sOrderObj.get(“Cleaned_By_Joe”)},{"label":"Con Note No", "value": sOrderObj.get(“Consignment_Note_Number”)},{“label":"DATE INVOICE SENT", "value": sOrderObj.get(“DATE_INVOICE_SENT”)},{“label":"Delivery Terms", "value": sOrderObj.get(“Delivery_Terms”)},{“label":"Shipment Date", "value": sOrderObj.get(“Ready_For_Despatch_Date”)},{“label":"Freight Company", "value": sOrderObj.get(“Freight_Company_Out”)},{“label":"Freight Company", "value": sOrderObj.get(“Freight_Company_Out”)},{“label":"Payment Received Date", "value": sOrderObj.get(“Payment_Received_Date”)},{“label":"PO Received Date", "value": sOrderObj.get(“PO_Received_Date”)},{“label":"Sales Order#", "value": sOrderObj.get(“Project_Quote_Number”)},{“label":"PO Number", "value": sOrderObj.get(“Purchase_Order”)},{“label":"Quote Category", "value": sOrderObj.get(“Quote_Category”)},{“label":"Sales Order Type", "value": sOrderObj.get(“Sales_Order_Type”)},{“label":"Status", "value": sOrderObj.get(“Status”)},{“label":"Subject", "value": sOrderObj.get(“Subject”)}]);
createSoInZBRes = zoho.books.createRecord("SalesOrders","668072369", mp);
info createSoInZBRes;
15 changes: 15 additions & 0 deletions Deluge Functions/Custom Functions/Current_Value_In_Previous.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Author: georgeotj
// Description: To be able to keep a history of status changes, we must ensure that we still keep the previous choice. This will work with a Workflow that will only run when new deals are created.
// Requirements: In the deals module, you must create 2 Custom Fields that will store the current and the previouas status'.
// Arguments: dealId = Deal Id

// Declare variables
deal = zoho.crm.getRecordById("Deals",dealId);

//Code
currentClosing = deal.get("Expected_Close_Date");
previousClosing = deal.get("Previous_Close_Date");
mp = Map();
mp.put("Previous_Close_Date",deal.get("Expected_Close_Date"));
updateResp = zoho.crm.updateRecord("Deals",dealId,mp);
info updateResp;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This folder will contain custom functions for Zoho CRM. These functions will have the following format

// Author: georgeotj
// Description: This function will track total revenue by adding up all the deals
// Requirements: This will require a custom field in the "Accounts" module, it will be called Total Revenue.
// Arguments: accountId:Account Id, Total_Revenue:Total Revenue

// Declare variables
accountID1 = accountId.toString();
resp = zoho.crm.getRelatedRecords("Deals","Accounts",accountId);
total = 0.0;

// Code
for each rec in resp
{
stage = rec.get("Stage").toLowerCase();
if(stage.contains("won"))
{
total = total + rec.get("Amount").toDecimal();
info total;
updateResp = zoho.crm.updateRecord("Accounts",accountId,{"Total_Revenue":total});
info updateResp;
}
}
70 changes: 70 additions & 0 deletions Deluge Functions/Custom Functions/Lead_Scoring.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
This folder will contain custom functions for Zoho CRM. These functions will have the following format

// Author: georgeotj
// Description: To rate leads, we want to follow certain criteria like having a phone numberm, email, and more information.
// Requirements: Leads module with a custom text field called, "LeadScore"
// Arguments: leadId:Lead Id, phone:Phone, email:Email, title:Title, website:Website, industry:Industry, scoreField:LeadScore

// Declare variables


// Code
//Verify that if the fields are null (different from isEmpty())
if(phone.isNull()) {
phone = "";
}
if(email.isNull()) {
email = "";
}
if(title.isNull()) {
title = "";
}
if(website.isNull()) {
website = "";
}
if(industry.isNull()){
industry = "";
}
if(scoreField.isNull() || scoreField.isEmpty()) {
scoreField = "";
}

//Start counting up the points
point = 0;

if(phone.length() >= 9) {
point += 2;
}
if(!(email.contains("gmail") || email.contains("yahoo") || email.contains("outlook") || email == "")) {
point += 2;
}
if(title.contains("CEO") || title.contains("manager") || title.contains("dir") || title.contains("VP")) {
point += 2;
}
if(!website.isBlank()) {
point += 2;
}
if(industry.contains("ERP")) {
point += 2;
}

//Calculating the points.
if(point >= 9) {
score = "*****";
}
else if(point >= 7) {
score = "****";
}
else if(point >= 5) {
score = "***";
}
else if(point >= 3) {
score = "**";
}
else if(point >= 1) {
score = "*";
}
else {
score = "";
}
updatedResponse = zoho.crm.updateRecord("Leads",leadId,{"LeadScore":score});
26 changes: 26 additions & 0 deletions Deluge Functions/Custom Functions/Mass_Update_of_Child_Contacts.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Author: georgeotj
// Description: Automatically updates the address of child contacts whenever the address information for the Account is updated.
// Requirements: N/A
// Arguments: accID = Account Id

// Declare variables
rec = zoho.crm.getRecordById("Accounts",accId);
resp = zoho.crm.getRelatedRecords("Contacts","Accounts",accId);

// Code
for each ele in resp
{
mp = Map();
mp.put("Mailing_Street",rec.get("Billing_Street"));
mp.put("Mailing_City",rec.get("Billing_City"));
mp.put("Mailing_State",rec.get("Billing_State"));
mp.put("Mailing_Zip",rec.get("Billing_Code"));
mp.put("Mailing_Country",rec.get("Billing_Country"));
mp.put("Other_Street",rec.get("Shipping_Street"));
mp.put("Other_City",rec.get("Shipping_City"));
mp.put("Other_State",rec.get("Shipping_State"));
mp.put("Other_Zip",rec.get("Shipping_Code"));
mp.put("Other_Country",rec.get("Shipping_Country"));
contactId = ele.get("id");
updateResp = zoho.crm.updateRecord("Contacts",ele.get("id"),mp);
}
10 changes: 10 additions & 0 deletions Deluge Functions/Custom Functions/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This folder will contain custom functions for Zoho CRM. These functions will have the following format

// Author:
// Description:
// Requirements:
// Arguments:

// Declare variables

// Code
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Author: georgeotj
// Description: When your CRM has a lot of customers with different shipping addresses, managing them could become a pain. Using this, a user can create a Zoho Creator application that will allow the user to modify a Creator form that would easily change the shipping address depending on which Account the user selects.
// Requirements: Several modifications are required for this script to run correctly, this includes creating a new module and related list.
// Arguments: N/A

// Declare variables
accountId = input.Account_Name.toLong();
relRecs = zoho.crm.getRelatedRecords("Associated_Shipping_Location","Accounts",accountId);

// Code
clear Shipping_Address;
for each rec in relRecs
{
input.Shipping_Address:ui.add(rec.get("Name"));
}
Loading