You need to sign in to do that
Don't have an account?
SFDC#Newbie
Apex Rest Api create duplicate leads
I have written a custom Apex rest api, that will create and update lead in salesforce. Whenever the api is called from external system, salesforce will get a json file which will have lead deatails and email id. If the email id already exists in salesforce it will update the lead. Else create a new one.
Whenever there is some 2 or more requests call at same time and it is lead creation requests, both requests are inserting the leads. This creates the duplicate lead.
We can enable duplicate rule, but it will not process another request. I want to process all requests without skipping any requests.
Do you have solution for this issue
Thanks
Whenever there is some 2 or more requests call at same time and it is lead creation requests, both requests are inserting the leads. This creates the duplicate lead.
We can enable duplicate rule, but it will not process another request. I want to process all requests without skipping any requests.
Do you have solution for this issue
Thanks
This might help you.
Check it once.
So what we need to do here is deserialize this and create a list of leads code would look something like this
Basically, you have to replace the object instance you got from JSON with the one which already exists in the system(which have ids)
Best Regards
Dushyant Srivastava
Thanks @Abhishek,
I will try on duplicate rule, if duplicate detected I will try to process the request again. so that the another request update on same record. Let you know how its work
I wanted to clarify that json would be like below, one lead object will send on one time.
And some times the requests are landing on same time. I have shared the screenshot of requests time here. The issue is while one request is processing another request also processing. At this time the query is not fetching the inserted records in that too fast. There is some delay in database comit and fetching the results. Here the duplicate records creating.
Thanks