1

I am using the .NET toolkit to integrate a website I am developing into Salesforce. Primarily the client wants to push entire quotes into Salesforce with the website. At the moment I am creating the opportunity, quote and line items using seperate API calls. Is it possible to build the whole object graph and insert in one hit, using the ForceClient CreateAsync method? I can see that it is possible by 'manually' using the REST API and building your own JSON, but can't see any documentation regarding doing it with the toolkit. Is it just a case of creating an Opportunity objects with a collection called Quotes, and the Quotes with a collection called QuoteLineItems?

I am mainly trying to determine whether it's even possible before I spend development time trying to implement something that can't ever work.

0

To create multiple nested records in one REST API call you need to use the composite resource.

The Force.com Toolkit for .NET is essentially a wrapper for the REST APIs.

A search of the current github source code doesn't show any occurrences of "composite", so I'd conclude that it isn't supported natively.

Options:

  1. I did find a recent pull request to support creating multiple records call. Creating multiple records and nested records have a very similar usage of the composite resource. You might be able to adapte it to your requirements.
  2. You could create a dedicated REST API that takes your exact data and creates the related records via multiple DML calls in Apex.
|improve this answer|||||
  • 1
    A while ago now, but thanks for this! I examined the pull request you mentioned and implemented something similar in the Force.com Toolkit myself. – chipples Apr 28 '17 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.