Solved

Best way to insert records to GS Relationship Object

  • 4 July 2018
  • 3 replies
  • 121 views

Hi guys,

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.



Thanks,
icon

Best answer by karl_rumelhart 5 July 2018, 19:31

View original

3 replies

Badge +3
Hello.  A direct "Load to Relationships" API is in the works but for now the best path is to use Rules.  One thing to note is that you can now trigger a Rule using an event instead of needing to schedule the rule run. E.g. from a Salesforce trigger you can generate a Gainsight event that initiates the rule that creates any pending Relationship records.   So, hopefully, it will be easier to fit this into your flow.  However, please be aware that, despite this capability, Rules are still optimized for batch operation and won't scale to being triggered continuously.  If you are going to have significant volume of new records you will need to batch them up, which might take you back to running the Rule on a schedule. 
Hi Karl,



I will try to insert the Relationship records from contracts that as I said is uploaded by our API.



My concern now is if the rule can update in once all fields. We have around 100 fields to read in contract object and write to Relationship Object. Anyway, I will try it.



But when u say "Load to Relationships API is in the works" what you mean? Gainsight is working to have an API to relationship that will perform better than by rules?



Thanks for attention.
Badge +3
Great.  In the Rule Action you can map the fields so you should be fine there. 



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. 

Reply