Create Portal Script

Create Portal Script

You may wish to create a Workflow Rule or run code in the After section of a Blueprint transition that creates a Client Portal Record (with all the Client Portal Items from your chosen Template).

The below script will use a ZE Portal built-in function to create a DEAL Portal Record:

  1. // CHANGE THE VALUES DENOTED BY ##:
  2. Template_ID = ##YOUR-CHOSEN-TEMPLATE-RECORD-ID##; // This should be the record ID of the Template Record - This is an integer, so should NOT be surrounded by inverted commas
  3. Deal_ID = ##YOUR-CHOSEN-DEAL-RECORD-ID##; // This should be the record ID of the Deal Record - This is an integer, so should NOT be surrounded by inverted commas
  4. Portal_Person_Lookup_Field_API_Name = "##Deal_Contact_Lead_or_Vendor_Lookup_Field_API_Name##"; // This should be set to the Person Lookup Field API Name from the Deal Record (for example "Contact_Name"); - MUST be surrounded by inverted commas
  5. Portal_Person_ID = ##YOUR-CHOSEN-PORTAL-PERSON-RECORD-ID##; // This should be the record ID of the Contact, Lead, or Vendor Record linked to the above Deal Record - This is an integer, so should NOT be surrounded by inverted commas
  6. Person_Type = // "##SET-PERSON-TYPE-HERE##"; // "Contact" OR "Vendor" OR "Lead" - Must match the Record Type of the Record ID above - Must be surrounded by inverted commas
  7. //
  8. Deal_Record = zoho.crm.getRecordById("Deals", Deal_ID); 
  9. //
  10. Portal_Person_Mini_Record = Deal_Record.getJSON(Portal_Person_Lookup_Field_API_Name); // SEE ABOVE NOTES
  11. //
  12. if ( Portal_Person_Mini_Record != null )
  13. {
  14.     Portal_Person_ID = Portal_Person_Mini_Record.getJSON("id");
  15.     //
  16.     Args_Map = map();
  17.     Args_Map.put("Portal_Template_Record_ID", Template_ID);
  18.     Args_Map.put("Deal_ID", Deal_ID);
  19.     Args_Map.put( Person_Type + "_ID", Portal_Person_ID );
  20.     //
  21.     Params_Map = map();
  22.     Params_Map.put("arguments", Args_Map);
  23.     //
  24.     crmAPIRequest = map();
  25.     crmAPIRequest.put("params", Params_Map);
  26.     //
  27.     Response = zep.Create_Portal_from_Template_API(crmAPIRequest);
  28. } else{
  29. info "No Portal Person ID Set";
  30. }


The below script will use a ZE Portal built-in function to create a Contact, Lead, or Vendor Portal Record:

  1. // CHANGE THE VALUES DENOTED BY ##:
  2. Template_ID = ##YOUR-CHOSEN-TEMPLATE-RECORD-ID##; // This should be the Record ID of the Template Record - This is an integer, so should NOT be surrounded by inverted commas
  3. Person_Type = // "##SET-PERSON-TYPE-HERE##"; // "Contact" OR "Vendor" OR "Lead" - Must be surrounded by inverted commas
  4. Portal_Person_ID = ##YOUR-CHOSEN-PORTAL-PERSON-RECORD-ID##; // This should be the Record ID of the Contact, Lead, or Vendor Record you want to create this Portal for - This is an integer, so should NOT be surrounded by inverted commas
  5. //
  6. Args_Map = map();
  7. Args_Map.put("Portal_Template_Record_ID", Template_ID);
  8. Args_Map.put( Person_Type + "_ID", Portal_Person_ID );
  9. //
  10. Params_Map = map();
  11. Params_Map.put("arguments", Args_Map);
  12. //
  13. crmAPIRequest = map();
  14. crmAPIRequest.put("params", Params_Map);
  15. //
  16. Response = zep.Create_Portal_from_Template_API(crmAPIRequest);