• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Log in
  • ☰
  • Solutions
  • Forums
  • Tickets
Solution home App Resources Salesforce

Salesforce: Create or Update Object (Upsert)

Created by: Adam Goh

Modified on: Thu, Jul 6, 2017 at 10:45 AM

How to perform an upsert in Salesforce


Workato action Create or Update object in Salesforce allows you to perform an Upsert action in Salesforce. That is, Salesforce will attempt to create an object with the provided values in the fields. 


However, when a Primary Key field is specified, and the object already exists with an identical value in the given Primary Key field, Salesforce will identify the existing object, and update the existing object with the values that were provided.


Primary Key field

Specify a field that allows you to uniquely identify a specific record for the object. Next, make sure that the given field is filled with the value that would be used to look in Salesforce.


sf_upsertInput.PNG



Upsert Condition

The provided Primary key field and value should only match to one specific object. If more than one object was found, the recipe will throw an error to notify of such situation.


sf_upserterror.PNG


 Can I use more than 1 Primary Key?

The simple answer is, no. However, there is a simple workaround. You can do a search action based on the Full Name, and have a conditional action stating if the Size (from the Search) is greater than 1 -- this evaluating as true would mean there are multiple records with that Full Name. There may be instances where there are two objects in a stated primary field contains more than one record for a particular value. If you would like to search for a record using 2 fields such as Full Name and Account, it would be best to use a Search action with both of those parameters and use conditional actions to check if present before updating or creating.


A
Adam is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

Related Articles

    Still can't find your solution?

    Visit our forums to search for answers, or post your own questions.

    Documentation
    Developer's Library
    Tutorials
    eBooks
    Expert Hour
    Product Hour
    Product Blog
    Workato Blog
    Product updates
    Customer Stories
    Workato 2018 © | Privacy | Terms | +1 (844) GO-WORKATO
    • Documentation
    • Workato Blog
    • Product Blog
    • Solutions
    • Forums
    • Tickets
    • Log in
    • Return to Workato