Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Retry Method for Dynamics CRM SDK

Posted on by 240

Hi,

I am creating create method using SDK but if the response is empty in create method how can i do retry to create a record?

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Retry Method for Dynamics CRM SDK

    Glat it worked.

    If found helpful, Please mark my answer verified.

  • Suggested answer
    madiri Profile Picture
    madiri 240 on at
    RE: Retry Method for Dynamics CRM SDK

    working fine tasks

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Retry Method for Dynamics CRM SDK

    Hi,

    Add try & catch block inside your create method in sdk. Create generic method to execute Create method and  Catch for any exception and based on exception you can try to call same method again.

    When you do _service.create(objCreateobj); in response you will get GUID of record create.

    You will never get empty guid so you have to use try and catch block to catch exception.

    Make a counter variable and retry to say 3 times then return from the code.

    static int retryCount=0;
    
    public void ExecuteMain()
    
    {
    
    try
    
    {
    
    Guid recordId=CreateRecord(service);
    }
    
    catch(Exception ex)
    
    {
    
    retryCount  ;
    
    if(retryCount

    If found helpful, Please mark my answer verified.

  • Verified answer
    miguelbeja Profile Picture
    miguelbeja on at
    RE: Retry Method for Dynamics CRM SDK

    Hi,

    Can you show sample of your code?

    You can try to validate how it is the response object, for example normally a create method returns a Guid of the object that was created, if it isn't returning is because it wasn't created.

    if (response.Id == Guid.Empty || response.Id == null)

    retry code

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans