setting owner of note when adding via deluge
My organization has requested the ability to mass update the notes related list in the deals module. Since this can't be done with the mass update feature, I created an update "notes single" line field and created a workflow rule that triggers a function when the "update notes" field is edited.
This function fetches the deal, and uses what was input to that field to add it as a note using the zoho.crm.createRecord task. This gives us a workaround to mass notes across multiple deals, but the added by field is defaulting to the superadmin. I am trying to make this appear like it was added by the owner of the deal.
- void automation.massUpdateNotes(Int lawsuitID)
- {
- // fetch the lawsuit
- lawsuit = zoho.crm.getRecordById("Deals",lawsuitID);
- //info lawsuit;
- // take the new note to be updated
- newNote = lawsuit.getJSON("update_notes");
- owner = lawsuit.getJSON("Owner");
- info owner;
- // assemble the note record
- addNote = Map();
- addNote.put("Parent_Id",lawsuitID);
- addNote.put("$se_module","Deals");
- addNote.put("Note_Title","Massed By: "+ownerName);
- addNote.put("Note_Content",newNote);
- addNote.put("Owner",owner);
- addNote.put("Modified_By",owner);
- addNote.put("Created_By",owner);
- //
- info zoho.crm.createRecord("Notes",addNote);
- }