getEntityName()); $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedRecordWsObject->getEntityName()); $relationLabel = false; $relationId = false; if (is_numeric($relationIdLabel)) { $relationId = $relationIdLabel; } else if (!empty($relationIdLabel)) { $relationLabel = $relationIdLabel; } if ($sourceModuleModel && $relatedModuleModel) { $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel, $relationLabel, $relationId); if ($relationModel) { foreach ($relatedRecordId as $id) { $idParts = vtws_getIdComponents($id); if ($idParts[0] == $relatedRecordIdParts[0]) { $relationModel->addRelation($sourceRecordIdParts[1], $idParts[1]); } } } } return array('message' => 'successfull'); } catch (Exception $ex) { throw new Exception($ex->getMessage()); } }