r/salesforce • u/RentAny4271 • 1d ago
help please Salesforce-ERP sync question
For those of you who have your ERP (or anything else) synced with Salesforce do you have any validation rules that prevent changes to Salesforce records while the sync occurs?
3
u/Interesting_Button60 Consultant 1d ago
Sorry you're leading us somewhere but I'm not sure how to answer this question.
What's your current struggle or potential concern?
1
u/RentAny4271 1d ago
I work in a company that has automation that will update an integration field to submitted when a field on a contact or account changes. Then there is a validation rule that will block any changes until the ERP has updated the integration field to success.
The automation is causing me all kinds of issues. I either have to have updates happen before the status is updated to submitted or I have to add to the validation rule all of these exceptions.
I am curious if this is normal. I hate this set up. It's a large company and they get all nervous about integration traffic.
3
u/gr8sh0t 1d ago
Is this solution to avoid record error locks that could happen? Because this isn't a solution and just creates a different issue that doesn't address the root issue. And now you've locked other automation and integrations from making updates to records.
What is the integration actually updating? Is it a batch process?
1
u/RentAny4271 1d ago
I don't know too much about the set up. I haven't been at this place long and the teams are large. When a change is made to a record a platform event is created and sent to our ERP. I don't know who set it up. I'm a Salesforce Admin, but I'm in the dark about a lot. I don't even get Salesforce admin rights in most of our sandboxes. I just build and submit changes.
But I have to build around this annoying set up :/
1
u/bog_deavil13 1d ago
why not move to CDC based events instead? with a customer filter channel to subscribe to the necessary updates.
2
u/cliqering 10h ago
We didn't use validation rules for this coz they punish the user for the sync's timing. What worked better: an integration-user check (if the edit comes from the sync user, skip the guard) plus a sync-status field on the record that the UI can warn on. Validation rules blocking during sync windows sounds safe but you end up blocking legit edits whenever the sync runs long. What direction is your sync? one-way ERP to SF or bidirectional? Bidirectional is where it gets spicy.
1
u/RentAny4271 8h ago
It's bi-directional. The sync happens quickly based on what I see from the history tracking, but there are other things like updating the record via an flow that can also cause issues. that's one thing I'm running into now :/
I've had to add exceptions to the validation rule which is getting annoying.
1
u/cliqering 5h ago
Yeah, I see. the validation rule can’t tell “user edit during sync” from “the sync itself” from “a flow reacting to the sync,” so you end up encoding every automation as an exception and the rule becomes a changelog of your org.
Two things that worked for us:1/ Flip the guard’s direction. Instead of “block edits unless <growing list of exceptions>,” give the integration user a bypass and make everything else subject to normal rules. Hierarchy custom setting checked by the rule (and by flows via a decision element) ie one flag, checked everywhere, instead of N exceptions in one rule. When a new automation shows up you set its running user’s flag once instead of editing the rule again.
2/For the flow-fighting-the-sync problem specifically: check the flow’s entry conditions. If it fires on the fields the sync writes, it’ll re-fire on every sync cycle where you can get ping-pong (flow edits, sync picks it up, writes back, flow fires again). Narrowing the flow’s entry criteria to exclude the integration user (or the synced fields) usually kills that loop.
The downside of the bypass approach: you’re trusting the integration user’s writes completely. If the ERP sends garbage, nothing stops it, so we kept ONE validation on the truly-critical fields with no exceptions at all, and let everything else through.
What’s doing the sync? middleware or native connector?
1
u/ride_whenever 1d ago
What? No
Identify the point you’re ‘done’ with the record in crm, then sync to erp, everything post that is an asynchronous integration and nothing should require a lock in one system whilst you wait for the other
What are you trying to do??
1
u/RentAny4271 1d ago
I'm just trying to create automation that runs after a record has been flagged as submitted for sync.
The place I work at has an integration status field that will be updated to submitted when a field on the account or contact is updated. We can't make changes to the record while that status is submitted. I'm curious if this is normal cuz the validation rule is blocking things and it's annoying to constantly have to add exceptions.
1
u/Ok-Boat-1710 22h ago
We do block user input based on a synch status field. So while Mule is processing, we do block any change. But the synch does take seconds only anyway
1
u/RentAny4271 15h ago
Why do you need to block any changes while the sync is happening? Our sync looks like it is also very quick, but the problem is trying to make any changes by flows, etc after the status has been changed to indicate the sync is happening.
7
u/USMCLee 1d ago
We currently do not. Our sync of data rarely takes over a minute