0

Hello everyone I have rather interesting problem (at least for me) I have an REST endpoints which sends me data that looks like this

{
  "user": {
    "name": "demo",
    "phones": [
      "iPhone",
      "Samsung"
    ],
    "address": "address"
  }
}

I have a corresponding java model (User has a list of group etc. really simple) The task is to send this data to salesforce using apache-camel while migrating single Entity (user) is quite simple and comes down to

from("direct:start")
            .setHeader("Authorization", constant("Basic a2tkYl9zZnJlYWQ6a2tkYl9zZjg2NQ=="))
            .to(MY_SOURCE)
            .bean(UserProcessor.class, "process")
            .to(SALESFORCE);

I can't figure out how to associate groups with user, since they are connceted through ID fields ( phone has user_id property ) which don't exist yet obviously because the migration process is still ongoing. Is there any way that I can migrate both things simultaneously?

kamk
  • 13
  • 4
  • Are the "groups" a custom Salesforce Object? – Tiaan Swart Feb 03 '18 at 03:26
  • I think you should elaborate your question. – min Feb 04 '18 at 15:05
  • @TiaanSwart It's standard salesforce object. The basic question is how to bind two objects together if the only connection they share is "ID" and I can't access it because it doesn't exist yet – kamk Feb 05 '18 at 08:46

1 Answers1

0

If you want to create different SF Object records and link them together then first create the parents and then use the Id from the parents to create the child records.

You can create the records without the Salesforce Id and link them together only if you have an external Id that can link the two records.

For the grouping you will need to do separate calls or build a API that can receive your data and properly insert or upsert in Salesforce.

Refer to documentation for more:

https://developer.salesforce.com/page/Salesforce_APIs https://help.salesforce.com/articleView?id=000002783&type=1

Tiaan Swart
  • 614
  • 5
  • 17