Finish the Submission Scripts and Test Your Form Automations

The below code updates the Deal, adds a Note if applicable, and adds a Task if applicable.

dealMap = Map();
dealMap.put("Amount",input.Amount);
dealMap.put("Deal_Name",input.Deal_Name);
dealMap.put("Closing_Date",input.Closing_Date);
dealUpdate = zoho.crm.updateRecord("Deals",input.Deal_ID.toNumber(),dealMap);
// Write the add Note code below
if(add_note)
{
 info "going to add a note";
 note1 = Map();
 note1.put("Note_Content",input.Note);
 note1.put("Parent_Id",input.Deal_ID);
 note1.put("se_module","Deals");
 dataList = List();
 dataList.add(note1);
 params = Map();
 params.put("data",dataList);
 response = invokeurl
 [
  url :"https://www.zohoapis.com/crm/v3/Notes"
  type :POST
  parameters:params.toString()
  connection:"zohocrm"
 ];
 info response;
}
// Write the add task code below
if(create_task)
{
 info "going to add a task";
 taskMap = Map();
 taskMap.put("What_Id",input.Deal_ID);
 taskMap.put("$se_module","Deals");
 taskMap.put("Due_Date",input.Due_Date);
 taskMap.put("Priority",input.Priority);
 taskMap.put("Subject",input.Task_Subject);
 taskMap.put("Status","Not Started");
 createTask = zoho.crm.createRecord("Tasks",taskMap);
}
Back to Lesson