You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to seed Salesforce org using values from Spreadsheet, and seem close to having it work, but getting some errors.
The recipe should use SalesforceQuery to prematch any Contacts with the same email addresses as one in CSV Dataset.
If no match was found, a new Contact record should be created.
This recipe works when a Contact matching the email address already exists in the Salesforce org.
However, the same recipe throws an error if no match was found.
How can I conditionally upsert pre-existing matched record in recipe, or create a new one if no matches were found?
- plugin: snowfakery.standard_plugins.Salesforce.SalesforceQuery
- plugin: snowfakery.standard_plugins.datasets.Dataset
- object: Account
nickname: account_new
for_each:
var: contact_row
value:
Dataset.iterate:
dataset: contact-list-company-email.csv
fields:
Name: ${{contact_row.Company | trim }}
# Create hidden field to store found record.
__contact_found:
SalesforceQuery.random_record:
from: Contact
fields: Id,Email
where: Contact.Email='${{contact_row.Email | trim}}'
# Create hidden field for the new record to be used if no pre-existing matches Contact is found.
__contact_new:
- object: Contact
fields:
Email: ${{contact_row.Email | trim }}
hed__AlternateEmail__c: ${{contact_row.Email | trim }}
hed__Preferred_Email__c: Alternate Email
friends:
- object: Campaign
nickname: Campaign1
fields:
Name:
fake: CatchPhrase
IsActive: true
- object: CampaignMember
fields:
Campaign:
reference: Campaign1
ContactId:
if:
- choice:
# If a Contact was found matching this email address, the use the found record.
when: ${{ account_new.__contact_found.Id!=NULL }}
pick: ${{ account_new.__contact_found.Id }}
- choice:
# Else default to making a new Contact
pick:
reference: __contact_new
The text was updated successfully, but these errors were encountered:
I'm trying to seed Salesforce org using values from Spreadsheet, and seem close to having it work, but getting some errors.
The recipe should use SalesforceQuery to prematch any Contacts with the same email addresses as one in CSV Dataset.
If no match was found, a new Contact record should be created.
This recipe works when a Contact matching the email address already exists in the Salesforce org.
However, the same recipe throws an error if no match was found.
How can I conditionally upsert pre-existing matched record in recipe, or create a new one if no matches were found?
Really appreciate any help!
CSV Dataset
Recipe
The text was updated successfully, but these errors were encountered: