Hello,
I tried the Callback action (jb-custom-callback). I made a custom method in UserRequest:
<method id="UserRequestAutoAssignOnCreate" _delta="define"> <static>false</static> <access>public</access> <type>UserMethod</type> <arguments/> <code><![CDATA[ public function UserRequestAutoAssignOnCreate() { $iSubcategoryId = $this->Get('servicesubcategory_id'); if (empty($iSubcategoryId)) { return; }
error_log(">>> func called\n", 3, APPROOT . '/log/autoassign.log'); $oSubcategory = MetaModel::GetObject('ServiceSubcategory', $iSubcategoryId, false); if ($oSubcategory == null) { return; } $iSupportTeamId = $oSubcategory->Get('support_team'); if (!empty($iSupportTeamId)) { $this->Set('team_id', $iSupportTeamId); } } ]]>
I have to call it when a userRequest is created. I used this path : \Ticket\UserRequest:UserRequestAutoAssignOnCreate
I tried to extend the OnInsert method, but it doesn't work:
<method id="OnInsert"> <static>false</static> <access>protected</access> <type>Overload-DBObject</type> <![CDATA protected function OnInsert() { parent::OnInsert(); $this->SetIfNull('last_update', time()); $this->SetIfNull('start_date', time()); $this->UserRequestAutoAssignOnCreate(); error_log(">>> OnInsert called\n", 3, APPROOT . '/log/autoassign.log'); } ]> </method>
<![CDATA protected function OnInsert() { parent::OnInsert(); $this->SetIfNull('last_update', time()); $this->SetIfNull('start_date', time()); $this->UserRequestAutoAssignOnCreate(); error_log(">>> OnInsert called\n", 3, APPROOT . '/log/autoassign.log'); } ]>
I think the callback is a better solution for me. Could somebody help me? Thanks in advance
Log in to post a comment.
Hello,
I tried the Callback action (jb-custom-callback). I made a custom method
in UserRequest:
error_log(">>> func called\n", 3, APPROOT . '/log/autoassign.log');
$oSubcategory = MetaModel::GetObject('ServiceSubcategory',
$iSubcategoryId, false);
if ($oSubcategory == null) {
return;
}
$iSupportTeamId = $oSubcategory->Get('support_team');
if (!empty($iSupportTeamId)) {
$this->Set('team_id', $iSupportTeamId);
}
}
]]>
I have to call it when a userRequest is created.
I used this path : \Ticket\UserRequest:UserRequestAutoAssignOnCreate
I tried to extend the OnInsert method, but it doesn't work:
<method id="OnInsert">
<static>false</static>
<access>protected</access>
<type>Overload-DBObject</type>
<![CDATA
protected function OnInsert()
{
parent::OnInsert();
$this->SetIfNull('last_update', time());
$this->SetIfNull('start_date', time());
$this->UserRequestAutoAssignOnCreate();
error_log(">>> OnInsert called\n", 3, APPROOT . '/log/autoassign.log');
}
]>
</method>
I think the callback is a better solution for me. Could somebody help me?
Thanks in advance