Notifications
Announcements
No record found.
Hi,
I need code to reopen or reactivate the closed leads using web api,similar to Reactivate lead button.
//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 } );
function reactivateLead() { debugger; var leadId = Xrm.Page.data.entity.getId(); // Current lead ka ID lete hain if (leadId) { var entityFormOptions = {}; entityFormOptions["entityName"] = "lead"; entityFormOptions["entityId"] = leadId; var parameters = {}; parameters["statuscode"] = 1; // Status code for reactivation parameters["statecode"] = 0; // State code for active Xrm.WebApi.updateRecord("lead", leadId, parameters).then( function success(result) { console.log("Lead reactivated successfully."); // Optionally, you can refresh the form or redirect Xrm.Page.data.refresh(); }, function (error) { console.error("Error reactivating lead: " + error.message); alert("Error: " + error.message); } ); } else { alert("Lead ID not found."); } }
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 51 Most Valuable Professional
André Arnaud de Cal... 38 Super User 2025 Season 2
#ManoVerse 31