I need to clone the quote entity with all the associated entities on it (quote_details,...). I would like to go without C#/workflow code.
As far as I know, there is no function in the CRM-RestKit.
My javascript-script looks as follows:
CreateCopy: function () { Alert.showLoading(); var id = Common.GetEntityId(); SDK.REST.retrieveRecord(id, "Quote", null, "quote_details", // add more linked entities here function (quote) { CreateNewQuoteAsCopy(quote); }, function(msg) { Common.ShowErrorMessage(msg); }); }, CreateNewQuoteAsCopy(quote) { quote.QuoteId = null; quote.Name = "COPY: " + quote.Name; SDK.REST.createRecord(quote, "Quote", function(newQuote) { Alert.show("Quote copied", "The quote was successfully copied", [ new Alert.Button("OK") //new Alert.Button("Open copy", Common.OpenEntity(id)) ], "SUCCESS"); }, function(errorMsg) { Common.ShowErrorMessage(errorMsg); }); },
In the javascript I only copied the quote without related entities. Therefore I expanded the retrieve-query for the quote details, so that at least the products are copied. Unfortunately I get an error:
Bad Request: Error processing request stream. The payload must represent a valid array format for collections.
So to speak: my solution does not work, can anyone answer me the question:
How do I clone the entity with all the associated entities?
Thanks in advance
*This post is locked for comments
Hi. worstcase. Any luck with this? Been trying to find out how to do this for a while now.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156