CoreBOSBB
attach a product to a contact - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17)
+--- Forum: Administrator Support (https://discussions.corebos.org/forumdisplay.php?fid=8)
+--- Thread: attach a product to a contact (/showthread.php?tid=1905)



attach a product to a contact - slechaix - 08-13-2020

Hi

Is there a web service to attach or link a product to a contact ?

I'm migration from vtiger 5.4 to corebos 8 and I did made a web service for vt5.4.
But the same web service doesn't work anymore after migration.

In my CRM, a contact or customer can have multiple unique products identified by a serial number.
I'm using a POS application to create a contact in the CRM and to assign him a product.

thanks for your help


RE: attach a product to a contact - joebordes - 08-13-2020

there are two ways of establishing a relation via web service

1.- when creating/updating

create and update support a "virtual" field named "relations"
https://github.com/tsolucio/corebos/blob/master/include/Webservices/Create.php#L23

which you can pass in like the other fields, it is an array of records you want to relate to the record you are creating/updating

2.- SetRelation web service end point

https://github.com/tsolucio/corebos/blob/master/build/wsChanges/setRelation.php
https://github.com/tsolucio/coreBOSwsDevelopment/blob/master/testcode/424_setrelated.php

Obviously, both support the standard way of relating modules, if you have implemented your own relation you must follow the established way to override custom relations between modules for the two methods above to work

https://github.com/tsolucio/corebos/blob/master/vtlib/ModuleDir/ModuleFile.php#L129:L155


RE: attach a product to a contact - joebordes - 08-13-2020

I just had another idea: there are workflow tasks to establish relation between records, so maybe you can avoid the web service call completely by implementing some workflows

workflows are EXTREMELY important and powerful in coreBOS with respect to vtiger crm


RE: attach a product to a contact - slechaix - 08-13-2020

(08-13-2020, 11:34 AM)joebordes Wrote: there are two ways of establishing a relation via web service

1.- when creating/updating

create and update support a "virtual" field named "relations"
https://github.com/tsolucio/corebos/blob/master/include/Webservices/Create.php#L23

which you can pass in like the other fields, it is an array of records you want to relate to the record you are creating/updating

2.- SetRelation web service end point

https://github.com/tsolucio/corebos/blob/master/build/wsChanges/setRelation.php
https://github.com/tsolucio/coreBOSwsDevelopment/blob/master/testcode/424_setrelated.php

Obviously, both support the standard way of relating modules, if you have implemented your own relation you must follow the established way to override custom relations between modules for the two methods above to work

https://github.com/tsolucio/corebos/blob/master/vtlib/ModuleDir/ModuleFile.php#L129:L155

Hi Joe, thanks a lot for your advice. I think I'll try the second method.