Skip to main content

Notifications

Dynamics 365 general forum
Suggested answer

Code to reopen the closed leads using web api

Posted on by

Hi,

I need code to reopen or reactivate the closed leads using web api,similar to Reactivate lead button.

pastedimage1616074822362v1.png

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: Code to reopen the closed leads using web api

    Hi, 

    //set statecode to 0 aka open
    var data ={"statecode": 0}
    var leadId = "8F4FA496-3FF2-E311-9864-A45D36FC5F1C"; 
    
    // update the record
    Xrm.WebApi.updateRecord("lead", leadId, data).then(
        function success(result) {
            console.log("Lead updated");
            // perform operations on record update
        },
        function (error) {
            console.log(error.message);
            // handle error conditions
        }
    );

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Waed Ayyad!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 289,995 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 227,174 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans