• About
  • Contact me!

Salesforce Everywhere

~ Blog on Salesforce Dev and admin stuff

Salesforce Everywhere

Tag Archives: Duplicate records

Flow creates duplicate records during bulk update!

24 Tuesday Nov 2015

Posted by Mani in Salesforce Configuration

≈ Leave a comment

Tags

Duplicate records, Flow

I faced a strange issue w.r.t Flows which was creating Duplicate records when I did bulk update of records. Details are as follows.

We have a custom object Rate Card which stores information related to rates(Currency fields) based on the service and the account(master detail relationship between Account and Rate Card). Let’s say for physiotherapy service and the account (let’s say ‘HomeCare’), we capture several rate fields(Daily Rate, Half-a-day Rate, Hourly Rate etc). Also, we have Validated flag and once the record is validated(by checking the flag), we trigger a flow(below screenshot) from the process and it will create Pricebook, Product and Pricebook entry records since we want to create Opportunity and Opportunity Product from the Rate Card record.

flow screenshot

Each Pricebook corresponds to an account and Products which will be the services(e.g. Physiotherapy) that we provide to the account.

First step in the flow is to check if the pricebook exists and if it exists, create the product. If it doesn’t exist, create the pricebook and create the product.

Then, create a Pricebook Entry record for Standard Pricebook and a Pricebook Entry record for custom pricebook(associate the pricebook and product created in previous steps).

This works absolutely fine when I validate Rate Card records manually one by one in UI. But, we have around 500+Rate Card records for which we need to create Pricebook, Product and Pricebook Entry records. So, I went ahead and used dataloader.io to update Validated flag and unfortunately, flow created duplicate Pricebook records and this issue happens only for the account which has more than one Rate Card.

When I investigated further, I could find this link https://developer.salesforce.com/forums/ForumsMain?id=906F0000000ArtkIAC which highlights the same issue.

When I checked the logs, it looks like the flow runs in parallel for all the records that I updated so the first step Lookup Pricebook did not find the Pricebook for the  updated records, hence created duplicate entries.

Then, I found a workaround by extracting the accounts which has more than one Rate Card. From the list, make sure that I extracted Rate Card records which has unique account ids and update the Validated flag.  System created Pricebook, Products and Pricebook Entry as expected without any duplicates.Then, updated the Validated flag for the rest of the records and system created Pricebook, Products and Pricebook Entry records.

Has anyone else faced this issue before? Is it a known issue and if so, is there an idea for it in Salesforce Success community? Please let me know your comments.

 

Advertisement

Blog Stats

  • 114,773 hits

Archives

Recent Posts: Salesforce Everywhere

How to get field values on onLoad in lightning-record-edit-form in LWC?

Using Dynamic Actions

How to check if the logged in user is a Guest user or not in APEX class?

How to Close Quick action in LWC

Lightning component to filter Products and display results in lightning data table

Connect with me

  • View @manibalan_s’s profile on Twitter
  • LinkedIn

Developer links

  • Salesforce Developer website
  • Salesforce Success Community

Enter your email address and click on Follow us (below) to follow this blog and receive notifications of new posts by email.

Website Powered by WordPress.com.

  • Follow Following
    • Salesforce Everywhere
    • Already have a WordPress.com account? Log in now.
    • Salesforce Everywhere
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar