Detaching / removing a relationship through a trigger and at

Posted by Rollbase User on 02-Jul-2010 10:38

How can I detach a related record (ie. remove a relationship) with a Trigger? It's a many-to-many relationship. Also, I don't want to delete the record. Also, how would I Attach Multiple Child Records to a Parent Record with one trigger? The return type for Attach Record trigger is integer and will not accept comma-separated list of IDs to attach to. Thanks.

All Replies

Posted by Admin on 02-Jul-2010 11:30

Hi Mike,

To detach a record, I would update the record with a trigger and assign it all existing related record ids in the target lookup field, not including the one you want to detach.

To attach multiple child records, you can pass a comma separated list of IDs to the lookup field on the parent that represents the child relationship.

Hope this helps,
Matt

Posted by Admin on 02-Jul-2010 16:11

Matt is right, that should work. I'm also going to add new API to expose attach/detach functionality through Object Script.

Posted by Admin on 06-Jul-2010 11:49

I used the new APIs

rbv_api.attach(relName, objName1, objId1, objName2, objId2)
and
rbv_api.detach(relName, objName1, objId1, objName2, objId2)
. These did the job. Thanks

This thread is closed