Skip to content

Commit

Permalink
Add support for triggering an Assignment Rule
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gabe Blair committed Aug 11, 2017
1 parent 3f947e3 commit 028a7e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Request/InsertRecords.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
8 changes: 7 additions & 1 deletion Tests/Request/InsertRecordsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -64,4 +71,3 @@ protected function setUp()
$this->insertRecords = new Request\InsertRecords($this->request);
}
}

0 comments on commit 028a7e7

Please sign in to comment.