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.
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
Matt is right, that should work. I'm also going to add new API to expose attach/detach functionality through Object Script.
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