Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to add Javascript to Disqualify button on Lead Form

(0) ShareShare
ReportReport
Posted on by 5

On Lead forms when user clicks on Disqualify button i want to call our Custom javascript function to perform Something. How to achieve it? Through ribbon workbench i added a  javascript to just give some alert even that is not working. Do we need to add javascript for all the options shown for Disqualify? or we cant add Custom Javascript at all on Disqualify Button?

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: How to add Javascript to Disqualify button on Lead Form

    Hi Niti,

    Ideally when you customize action of Disqualify Lead button it will be impact your existing OOB functionality.  Better to write the logic inside plugin and throw exception from plugin.

    In other way you may try to write enable rule to show/Hide the button based on selection of the lead entity records. Here is the step -

    -> Go to ribbon workbench and select the buton.

    -> Click on Customize button and the Customize command.

    -> Go to command and then add custom javascript rule.

    -> Add your javascript funtion , select default false , invert false.

    -> Pass parameter type "‘SelectedControlSelectedItemReferences’" to get the lead ID.

    function run(selectedItems)
    {
        var selectedItem = selectedItems[0];
        // Here you can use the information below to open a new window or whatever!
        alert("Id=" + selectedItem.Id + "\nName=" + selectedItem.Name + "\nTypeCode=" + selectedItem.TypeCode.toString() + "\nTypeName=" + selectedItem.TypeName);
    }


    -> Retrieve the lead details using service request in the function and check your request and based on that return true or false.

    For more details you may get reference from here -

    ribbonworkbench.uservoice.com/.../129783-pass-the-currently-selected-grid-row-s-to-a-custo

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,399 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans