Skip to content

Instantly share code, notes, and snippets.

View jeznag's full-sized avatar

Jeremy Nagel jeznag

View GitHub Profile
@jeznag
jeznag / gist:0baf6f2fe9f54857bfb7
Created May 31, 2015 08:35
Add call log to Zoho CRM lead
void workflowspace.add_call_log(int lead_id)
{
lead_obj = zoho.crm.getRecordById("Leads", input.lead_id);
lead_name = ((lead_obj.get("First Name")) + " ") + lead_obj.get("Last Name");
lead_company = lead_obj.get("Company");
call_log_obj = map();
call_log_obj.put("Subject", "Call with " + lead_name);
call_log_obj.put("Call Type", "Outbound");
call_log_obj.put("SEMODULE", "Leads");
call_log_obj.put("SEID", input.lead_id);
@jeznag
jeznag / gist:e16cb7ad1d56e68cef75
Created June 3, 2015 22:52
Add notes to Zoho CRM contact
void workflowspace.add_notes_to_a_contact(int contact_id)
{
note_text = "Sample note";
note_obj = map();
note_obj.put("SEMODULE", "Contacts");
note_obj.put("SEID", input.contact_id);
note_obj.put("Note Title", "Test Title");
note_obj.put("Note Content", note_text);
create_resp = zoho.crm.create("Notes", note_obj);
info create_resp;
@jeznag
jeznag / gist:9a717efa3fb72344e811
Created June 28, 2015 09:21
Generate potentials for subscription revenue
void add_additional_potentials (int potential_ID )
potential_obj = zoho.crm.getRecordById("Potentials",input.potential_ID);
month_list={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
for each month in month_list
{
new_closing_date=(potential_obj.get("Closing Date")).toDate().addMonth(month);
new_potential_name=(("Auto-generated follow up potential for " + potential_obj.get(("Account Name"))) + " closing on ") + new_closing_date;
//check if there's already an existing potential for this month
existing_potential = zoho.crm.searchRecords("Potentials","(Potential Name|=|" + new_potential_name + ")",1,1);
info "Existing results: " + (existing_potential.size());
.questionTypeComponent {
.questionTypeSubComponent {
.someGenericClassNameThatWillProbablyBeUsedElsewhere {
line-height: 2.8;
}
}
}
.someGenericClassNameThatWillProbablyBeUsedElsewhere {
line-height: 2.8;
}
@jeznag
jeznag / calculate financial year
Created December 4, 2015 07:28
calculate financial year of zoho CRM date
If(
And(
(
Datecomp(${Tasks.Due Date}, Newdate(2016, 07, 31, 12,00,'AM') )
< 0
),
(
Datecomp(${Tasks.Due Date}, Newdate(2015, 07, 31, 12,00,'AM') )
> 0
)
NAME_OF_ROLE_TO_ASSIGN_LEADS_TO = "SOMEROLE";
//you'll need to create this record and assign it to someone who should receive leads
//before you can use this function
ID_FOR_REFERENCE_LEAD = 1176607000005707001;
AUTH_TOKEN = "MYAUTHTOKEN"
//get a list of all users who can be assigned leads
userResp = getUrl(("https://crm.zoho.com/crm/private/xml/Users/getUsers?authtoken=" + AUTH_TOKEN + "&scope=crmapi&type=ActiveUsers"));
leadidStr = input.leadid.toString();
listOfLeadOwners = List:Int();
@jeznag
jeznag / updating url parameters of iFrame
Last active December 12, 2015 10:18
updating url parameters
<script>
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
ready(function () {
var username = QueryString.Username,
@jeznag
jeznag / gist:b5f885f211b210249f91b0723e1ef095
Created May 8, 2016 10:56
generate permutations of string
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});

Widget Menagerie