web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans