I saw this question in the Zoho forums and thought I'd respond:
My AnswerIs there way to auto-populate a field given a set of criteria?For example, I'd like all Potentials that close between a set of dates (i.e. between 1/1/2015 and 5/1/2015) to automatically populate the same text in a custom field I've called "Group."
- void modify_group_for_jim_based_on_closing_date ( int potential_id )
- potential = zoho.crm.getRecordById("Potentials",input.potential_id);
- the_closing_date=(potential.get("Closing Date")).toDate();
- date_window_1=("1/1/2015").toDate();
- date_window_2=("1/5/2015").toDate();
- date_window_3=("1/6/2015").toDate();
- date_window_4=("1/11/2015").toDate();
- potential_map=map();
- if((the_closing_date >= date_window_1) && (the_closing_date <= date_window_2))
- {
- potential_map.put("Group","Group 1");
- }
- else if((the_closing_date >= date_window_3) && (the_closing_date <= date_window_4))
- {
- potential_map.put("Group","Group 2");
- }
- else
- {
- potential_map.put("Group","Unknown Group");
- }
- potential_id_str=input.potential_id.toString();
- updatedPotential = zoho.crm.updateRecord("Potentials",potential_id_str,potential_map);
- info "Response: " + updatedPotential;
Comments
Post a Comment