From 028a7e7f255a649767f701289ccf0a9c6a8136cb Mon Sep 17 00:00:00 2001 From: Gabe Blair Date: Thu, 10 Aug 2017 20:36:38 -0700 Subject: [PATCH] Add support for triggering an Assignment Rule It doesn't appear to be documented anywhere, but I learned from Zoho support that if you pass a `larid` param with the ID of a Zoho Assignment Rule as a parameter, that assignment rule will be kicked off in Zoho when you insert records via the API. I've only tested this out with inserting Leads. Mileage may vary in other types of cases. --- Request/InsertRecords.php | 10 ++++++++++ Tests/Request/InsertRecordsTest.php | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Request/InsertRecords.php b/Request/InsertRecords.php index 58a5ae3..0c7823a 100644 --- a/Request/InsertRecords.php +++ b/Request/InsertRecords.php @@ -51,6 +51,16 @@ public function triggerWorkflow() return $this; } + /** + * @param int $ruleId + * @return InsertRecords + */ + public function triggerAssignmentRule($ruleId) + { + $this->request->setParam('larid', $ruleId); + return $this; + } + /** * @return InsertRecords */ diff --git a/Tests/Request/InsertRecordsTest.php b/Tests/Request/InsertRecordsTest.php index dc56668..5b603f1 100644 --- a/Tests/Request/InsertRecordsTest.php +++ b/Tests/Request/InsertRecordsTest.php @@ -39,6 +39,13 @@ public function testTriggerWorkflow() $this->assertEquals('true', $this->request->getParam('wfTrigger')); } + public function testTriggerAssignmentRule() + { + $ruleId = 99001321231213; + $this->insertRecords->triggerAssignmentRule($ruleId); + $this->assertEquals($ruleId, $this->request->getParam('larid')); + } + public function testOnDuplicate() { $this->insertRecords->onDuplicateUpdate(); @@ -64,4 +71,3 @@ protected function setUp() $this->insertRecords = new Request\InsertRecords($this->request); } } - \ No newline at end of file