function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
inbox outbox 7inbox outbox 7 

HOw do we validate data coming from an external system ?

What if we get invalid data, how do we deal with that?
 
VinayVinay (Salesforce Developers) 
If you have active validation rule on data it would fail and you would need to handle business logic accordingly if you want to re-insert by storing failed record in new custom object and process data as per your requirement.

Thanks,
inbox outbox 7inbox outbox 7
@Vinay

Please advice me on how we would be able to save the record since the validation rule doesn't let us. 
 
VinayVinay (Salesforce Developers) 
You would need to process failed records and store in another new or existing custom object and process them manually by updated with correct data.

Hope this helps.

Thanks,
inbox outbox 7inbox outbox 7
@Vinay
If the callout is from UI (button) where the user is waiting for a response, will this approach work? Since there will be time contraint. 
VinayVinay (Salesforce Developers) 
Yes this should work and data would be processed in asynchornous mode and time contraint shouldn't matter.

Please mark as Best Answer if above information was helpful.

Thanks,
inbox outbox 7inbox outbox 7
Vinay, 

I thak you for replying. If the data is processed asynronous,  the resources might not be available, still the user will not be afffected by this approach? 

All I want to know is an approach that will not make the user wait, no latency, no delay in processing of failed validation data etc. Since the repsone data has to be updated in salesforce inorder for the record to be saved by the user. 
Opportunity, order creation in external system, order status, number and order quantity have to be upated on the opportunity record, so that the agent/user can save the record. 
VinayVinay (Salesforce Developers) 
You are right records will be executed whenever resources are avaiable and in chunks,  however it would be processed through API integration user at back end or you might have dedicated user for integration purpose.

Salesforce API user
https://help.salesforce.com/s/articleView?id=000331470&type=1

Please mark as Best Answer if above information was helpful.

Thanks,