synack
synack

Reputation: 21

Need for examples for the Vtiger "add_related" method

Please, give some invocation examples for the Vtiger "add_related" method.

I'm trying to call it in this way:

$result = $client->doInvoke('add_related', ['sourceRecordId' => '12x4', 'relatedRecordId' => '1x2', 'relationIdLabel' => 'Campaigns'], 'POST');

And every time I get false result.

This is what I don't really understand is purpose of the third parameter 'relationIdLabel'. A comment above the function declaration says: "@param $relationIdLabel - Relation id or label as in vtiger_relatedlists table". I've looked into that table and this made no sense for me :(

Upvotes: 1

Views: 338

Answers (1)

synack
synack

Reputation: 21

Oh, it's my bad. I figured out this method isn't implemented in 7.0. I've backported it from 7.1 and everything works now. It's pretty easy to do that even for 6.3 .. 6.5. You just need to put AddRelated.php (from 7.1 sources) to /include/Webservices/ and execute one of the SQL queries below:

For 7.0:

INSERT INTO `vtiger_ws_operation` VALUES (37,'add_related','include/Webservices/AddRelated.php','vtws_add_related','POST',0);
INSERT INTO `vtiger_ws_operation_parameters` VALUES (37,'sourceRecordId','string',1),(37,'relatedRecordId','string',2),(37,'relationIdLabel','string',3);

For 6.3 .. 6.5:

INSERT INTO `vtiger_ws_operation` VALUES (34,'relatedtypes','include/Webservices/RelatedTypes.php','vtws_relatedtypes','GET',0),(35,'retrieve_related','include/Webservices/RetrieveRelated.php','vtws_retrieve_related','GET',0),(36,'query_related','include/Webservices/QueryRelated.php','vtws_query_related','GET',0),(37,'add_related','include/Webservices/AddRelated.php','vtws_add_related','POST',0);
INSERT INTO `vtiger_ws_operation_parameters` VALUES (34,'elementType','string',1),(35,'id','string',1),(35,'relatedLabel','string',3),(35,'relatedType','string',2),(36,'id','string',2),(36,'query','string',1),(36,'relatedLabel','string',3),(37,'sourceRecordId','string',1),(37,'relatedRecordId','string',2),(37,'relationIdLabel','string',3);

Upvotes: 1

Related Questions