$variable->addKeyValue("your_custom_field_api_name", "custom_field_value"); |
$variable->addFieldValue(ModuleAPIName::FieldName(), new Choice("picklist_value")); |
$variable->addKeyValue("custom_picklist_field_api_name", new Choice("picklist_choice")); |
$lookupVariable = new Record(); $lookupVariable->addKeyValue("id", "lookup_record_id"); $recordVariable->addFieldValue(LookupModule::FieldName(), $lookupVariable); |
$lookupVariable = new Record(); $lookupVariable->addKeyValue("id", "lookup_record_id"); $recordVariable->addKeyValue("Lookup_Field_API_Name", $lookupVariable); |
$ownerVariable = new User(); $ownerVariable->setEmail("name@domain.com"); $recordVariable->addKeyValue("Owner_Field_API_Name", $recordVariable); |
<?php use com\zoho\crm\api\HeaderMap; use com\zoho\crm\api\record\BodyWrapper; use com\zoho\crm\api\record\RecordOperations; use com\zoho\crm\api\record\Contacts; use com\zoho\crm\api\util\Choice; use com\zoho\crm\api\users\User; use com\zoho\crm\api\record\Record; require_once "vendor/autoload.php"; class CreateRecords { public static function initialize() { // add initialisation code // refer to the previous post for details and examples } public static function createRecords1(string $moduleAPIName) { $recordOperations = new RecordOperations(); $bodyWrapper = new BodyWrapper(); $record = new Record(); //standard field $record->addFieldValue(Contacts::LastName(), "Boyle"); //custom field $record->addKeyValue("Designation", "Accountant"); // custom picklist field $record->addKeyValue("Pick_List_2", new Choice("Option 1")); //custom lookup field $lookup = new Record(); $lookup->addKeyValue("id", "5545974771087"); $record->addKeyValue("Lookup_1", $lookup); //Standard picklist field $record->addFieldValue(Contacts::LeadSource(), new Choice("Advertisement")); //Standard lookup field $lookup1 = new Record(); $lookup1->addKeyValue("id", "55459742674230"); $record->addFieldValue(Contacts::AccountName(), $lookup1); //Owner lookup field $recordOwner = new User(); $recordOwner->setEmail("pat.boyle@zylker.com"); $record->addKeyValue("Owner", $recordOwner); $bodyWrapper->setData([$record]); $trigger = ["approval", "workflow", "blueprint"]; $bodyWrapper->setTrigger($trigger); $headerInstance = new HeaderMap(); $response = $recordOperations->createRecords($moduleAPIName, $bodyWrapper, $headerInstance); //Add code to handle the response received in $response. // For more details, refer here. } } CreateRecords::initialize(); $moduleAPIName = "Contacts"; CreateRecords::createRecords1($moduleAPIName); |
$LookupVar1 = new Record(); $LookupVar1->addKeyValue("id", "lookup_record_id1"); $mslookupVariable1 = new Record(); $mslookupVariable1->addKeyValue("Field_API_Name", $LookupVar1); $LookupVar2 = new Record(); $LookupVar2->addKeyValue("id", "lookup_record_id2"); $mslookupVariable2 = new Record(); $mslookupVariable2->addKeyValue("Field_API_Name", $LookupVar2); $record->addKeyValue("Field_API_Name", [$mslookupVariable1, $mslookupVariable2]); |
$variable->addKeyValue("Picklist_Field_API_Name", [new Choice("Picklist_Value1"), new Choice("Picklist_Value2")]); |
$lookupVar1 = new User(); $lookupVar1->addKeyValue("id", "user_id1"); $mulookupVariable1= new User(); $mulookupVariable1->addKeyValue("Field_API_Name", $lookupVar1); $lookupVar2 = new User(); $lookupVar2->addKeyValue("id", "user_id2"); $mulookupVariable2= new User(); $mulookupVariable2->addKeyValue("Field_API_Name", $lookupVar2); $record->addKeyValue("Field_API_Name", [$mulookupVariable1, $mulookupVariable2]); |
<?php use com\zoho\crm\api\HeaderMap; use com\zoho\crm\api\record\BodyWrapper; use com\zoho\crm\api\record\RecordOperations; use com\zoho\crm\api\record\Contacts; use com\zoho\crm\api\util\Choice; use com\zoho\crm\api\users\User; use com\zoho\crm\api\record\Record; require_once "vendor/autoload.php"; class CreateRecords { public static function initialize() { // add initialisation code // refer to the previous post for details and examples } public static function createRecords1(string $moduleAPIName) { $recordOperations = new RecordOperations(); $bodyWrapper = new BodyWrapper(); $record = new Record(); $record->addFieldValue(Contacts::LastName(), "Boyle"); // custom multi-picklist $record->addKeyValue("Event_Participation", [new Choice("Webinar"), new Choice("Trade Show")]); //custom multi-lookup $lookup1 = new Record(); $lookup1->addKeyValue("id", "5545974471152"); $multiSelectLookup1 = new Record(); $multiSelectLookup1->addKeyValue("Products", $lookup1); $lookup2 = new Record(); $lookup2->addKeyValue("id", "554597771087"); $multiSelectLookup2 = new Record(); $multiSelectLookup2->addKeyValue("Products", $lookup2); $record->addKeyValue("Products", [$multiSelectLookup1, $multiSelectLookup2]); //multi-user lookup $userlookup1 = new User(); $userlookup1->addKeyValue("id", "5545974393001"); $multiUserLookup1 = new User(); $multiUserLookup1->addKeyValue("Sales_Reps", $userlookup1); $userlookup2 = new User(); $userlookup2->addKeyValue("id", "5545974492072"); $multiUserLookup2 = new User(); $multiUserLookup2->addKeyValue("Sales_Reps", $userlookup2); $record->addKeyValue("Sales_Reps", [$multiUserLookup1, $multiUserLookup2]); $bodyWrapper->setData([$record]); $headerInstance = new HeaderMap(); $response = $recordOperations->createRecords($moduleAPIName, $bodyWrapper, $headerInstance); //Add code to handle the response received in $response // For more details, refer here. } } CreateRecords::initialize(); $moduleAPIName = "Contacts"; CreateRecords::createRecords1($moduleAPIName); |
$xExternal = "Module.External_ID_Field_Name,Related_Module.External_ID_Field_Name"; $relatedRecordsOperations = new RelatedRecordsOperations($relatedListAPIName, $moduleAPIName, $xExternal); |
<?php use com\zoho\crm\api\relatedrecords\BodyWrapper; use com\zoho\crm\api\relatedrecords\RelatedRecordsOperations; use com\zoho\crm\api\record\Record; require_once "vendor/autoload.php"; class UpdateRelatedRecordsUsingExternalId { public static function initialize() { // add initialisation code // refer to the previous post for details and examples } public static function updateRelatedRecordsUsingExternalId1(string $moduleAPIName, string $externalValue, string $relatedListAPIName) { $xExternal = "Leads.External_ID,Products.External_Product_ID"; $relatedRecordsOperations = new RelatedRecordsOperations($relatedListAPIName, $moduleAPIName, $xExternal); $request = new BodyWrapper(); $record1 = new Record(); $record1->addKeyValue("External_Product_ID", "PR01"); $record2 = new Record(); $record2->addKeyValue("External_Product_ID", "PR02"); $request->setData([$record1, $record2]); $response = $relatedRecordsOperations->updateRelatedRecordsUsingExternalId($externalValue, $request); //Add your code to handle the response received in $response //For more details, refer here. } } UpdateRelatedRecordsUsingExternalId::initialize(); $moduleAPIName = "Leads"; $externalValue = "ABC123"; $relatedListAPIName = "Products"; UpdateRelatedRecordsUsingExternalId::updateRelatedRecordsUsingExternalId1($moduleAPIName, $externalValue, $relatedListAPIName); |
$streamWrapper = new StreamWrapper(filename, stream, null); |
$streamWrapper = new StreamWrapper(null, null, "provide_file_path_here"); |
<?php use com\zoho\crm\api\ParameterMap; use com\zoho\crm\api\file\BodyWrapper; use com\zoho\crm\api\file\FileOperations; use com\zoho\crm\api\util\StreamWrapper; require_once "vendor/autoload.php"; class UploadFiles { public static function initialize() { // add initialisation code // refer to the previous post for details and examples } public static function uploadFiles1() { $fileOperations = new FileOperations(); $bodyWrapper = new BodyWrapper(); $streamWrapper = new StreamWrapper(null, null, "/Users/user-1/Downloads/zoho.png"); $bodyWrapper->setFile([$streamWrapper]); $paramInstance = new ParameterMap(); $response = $fileOperations->uploadFiles($bodyWrapper, $paramInstance); //Add your code to handle the response received in $response //For more details, refer here. } } UploadFiles::initialize(); UploadFiles::uploadFiles1(); |
<?php use com\zoho\crm\api\HeaderMap; use com\zoho\crm\api\record\BodyWrapper; use com\zoho\crm\api\record\FileDetails; use com\zoho\crm\api\record\RecordOperations; use com\zoho\crm\api\record\ { Leads }; use com\zoho\crm\api\record\ImageUpload; use com\zoho\crm\api\record\Record; require_once "vendor/autoload.php"; class CreateRecords { public static function initialize() { // add initialisation code // refer to the previous post for details and examples } public static function createRecords1(string $moduleAPIName) { $recordOperations = new RecordOperations(); $bodyWrapper = new BodyWrapper(); $record = new Record(); $record->addFieldValue(Leads::LastName(), "Boyle"); $record->addFieldValue(Leads::FirstName(), "Patricia"); $record->addFieldValue(Leads::Company(), "Zylker Corp"); $imageUpload = new ImageUpload(); $imageUpload->setEncryptedId("39c17f1033cd120e62f8104c5450213ede77147fe6"); $record->addKeyValue("Image_Upload", [$imageUpload]); $fileDetail = new FileDetails(); $fileDetail->setFileId("39c17f1033cd120e62f8104c545af0efea6cc3c67cabefb16"); $record->addKeyValue("File_Upload", [$fileDetail]); $headerInstance = new HeaderMap(); $bodyWrapper->setData([$record]); $response = $recordOperations->createRecords($moduleAPIName, $bodyWrapper, $headerInstance); //Add your code to handle the response received in $response // For more details, refer here. } } CreateRecords::initialize(); $moduleAPIName = "Leads"; CreateRecords::createRecords1($moduleAPIName); |
Writer is a powerful online word processor, designed for collaborative work.