Recently I enabled the Relationship in our production and I have some doubts about how we could create our products in the Relationship Object.
Currently in the relation of 1:1 (1customer: 1Product) we put the information of the product in Contract Object but to use in Relationship we will migrate it.
My question is, what would be the most performative way to launch the records in Relationship?
1. Bulk API
2. Rule Engine
3. APEX Triggers / Class
4. Is there another option?
1. Today our API already creates the account and creates the contracts with the product information. We would have to do an extension to also insert into Relationship.
2. I have seen through your documentation that you are always guiding by rules. However, I see that by rules we can make a delay in our chain queue.
3. By apex, we can create a trigger that fires whenever a contract's record of Product type is created to replicate to the relationship. I have no idea of this performance, but it would alleviate our integration.
I haven't tested yet any of these with all accounts (~100.000 relationship records), but if you have already done something similar it may be interesting to share.
Best answer by karl_rumelhart
One other thing to consider is the possibility of using the Associated Object capabilities within the Relationships model. If you really have a 1-1 mapping between the Contract and the Relationship record then mapping the fields over makes sense. But suppose you had a situation where potentially more than one Contract corresponds to the Relationship. (A good example of where this may come up is associating Opportunities with a Relationship. You use the Relationship record to model the deployment of a product but the product gets renewed every year so there will be an unknown number of Opportunities that you may want to associate to the Relationship.) In that case, you can't easily copy things into the record itself so you connect them via an association.
Regarding the Relationship API: the goal is to let you interact with Relationships one record at a time (create, update, delete) rather than in bulk, which is how the Rules Engine is built.