Skip to main content

Notifications

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
    50,091 Moderator 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 the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans