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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

button 'contact via whatsapp' based on the contact mobile number

(0) ShareShare
ReportReport
Posted on by 230

Hi,

a customer show us a CRM where they today have a button near mobile phone, where salesperson can start a chat using whatsapp. As I know, what it does really is to combine the "https://wa.me/" url + 'number" (full phone number in international format) to be browse on a new window.

There is a way to customize a form and create a similar button for that?

I have the same question (0)
  • Suggested answer
    ashish12 Profile Picture
    3,079 on at
    RE: button 'contact via whatsapp' based on the contact mobile number

    Add a button for Whatsapp on the ribbon using XRMTOOLBOX, by using Xrm.Navigation.OpenUrl function.

  • cloflyMao Profile Picture
    25,210 on at
    RE: button 'contact via whatsapp' based on the contact mobile number

    Hi Renato,

    I created a solution and included following components:

    - a custom form which contains a custom field called WhatsApp ID

    - whatsapp icon 16x16 png

    - whatsapp icon 32x32 png

    - whatsapp icon 16x16 svg

    - jscript with custom functions

    pastedimage1577848536118v1.png

    Then I added a new button to the form, bind open WhatsApp function to the button with Ribbon Workbench.

    By using Xrm.Navigation.openUrl function, it'll wake up WhatsApp if you had installed the application.

    I tested in iOS 13.3, CRM application version is 13.19122.10.

    mobile.jpg 

    Code:

    function openWhatsApp() {
        var url = "https://wa.me/";
    
        var id = "";
    
        if (Xrm.Page.getAttribute("new_whatsappid") !== null) {
            if (Xrm.Page.getAttribute("new_whatsappid").getValue() !== null &&
                Xrm.Page.getAttribute("new_whatsappid").getValue() !== "") {
                id = Xrm.Page.getAttribute("new_whatsappid").getValue();
                Xrm.Navigation.openUrl(url   id);
            } else {
                alertDialog("Notice", "There is no whatsapp id for current contact.");
            }
        }
    }
    
    function alertDialog(title_val, text_val) {
        var alertStrings = {
            confirmButtonLabel: "Ok",
            text: text_val,
            title: title_val
        };
        var alertOptions = {
            height: 150,
            width: 250
        };
        Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
            function success(result) {
                console.log("Alert dialog closed");
            },
            function (error) {
                console.log(error.message);
            }
        );
    }
    

    Regards,

    Clofly

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 179

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 127 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans