Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Bypass Phone Call Quick Create Form

Posted on by 90

We have integrated our phone system with D365 and it automatically creates a phone call activity.  I would like to disable the Phone Call Quick Create Form.  How would I do that?  Thanks!

  • Jazeb Malik Profile Picture
    Jazeb Malik 20 on at
    RE: Bypass Phone Call Quick Create Form

    Hi Wahaj Rashid 

    All your remaining code works fine. except when it performs formContext.ui.close(). it prompts whether we want to save changes before the window closes.

    I have attached the Screenshot as well.

    ms-dynamics-prompt.PNG 

    This is the documentation URL of formContext.ui.close()

    I want to overcome this prompt with the help of JavaScript  code or through any sort of API . 

    Thanks
     

  • RE: Bypass Phone Call Quick Create Form

    Hi Wahaj,

    The script you provided in your blog worked successfully for our Dynamics 365 instance. However, recently, this is no longer working. We have tried to recreate the web resource but it will no longer close the quick create form

    Do you know of any updates required to get this script working again?

    Thanks,

    Paul

  • Maznira Profile Picture
    Maznira 5 on at
    RE: Bypass Phone Call Quick Create Form

    Hello Wahaj, I tried to implement your solution, but when clicking the phone button, I receive an error. Is there any other way to disable it? Thanks

  • DawnK Profile Picture
    DawnK 90 on at
    RE: Bypass Phone Call Quick Create Form

    Thank you Wahaj!  I will try this!

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Bypass Phone Call Quick Create Form

    Hi,

    I found a solution, it's a bit of a hack but works.

    So we know, we cannot stop launching the Phone Quick Create form, however, we can force close it when launched from Click-to-Call.

    Luckily, a query string parameter is passed named contactinfo which starts with 'tel:<phone number'. 

    Now, all we have to do is register an onLoad function on the Phone Quick Create to close the form when launched using Click-to-Call.

    Here is the code:

    function phOnLoad(executionConext) {
    
        var formContext = executionConext.getFormContext();
    
        var formType = formContext.ui.getFormType();
    
        if (formType != 1) { // If not Create, optional check as form is Quick Create
            
            return;
    
        }
        
    
        var params = Xrm.Utility.getGlobalContext().getQueryStringParameters();
    
        var contactinfo = params.contactinfo;
        
        if (contactinfo != null  && contactinfo != undefined
            && contactinfo.startsWith("tel:")) {
        
            // If Form is opened from TEL protocol, close the form forcefully.
            formContext.ui.close();
            
        }
    
    }

    Please see my blogpost for detailed steps and explanation:

    https://crmlogs.wordpress.com/2021/02/09/dynamics-365-ce-click-to-call-prevent-phone-quick-create/

    It's not that elegant, but works.

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Bypass Phone Call Quick Create Form

    Hi,

    As far as I know, you cannot stop this new phone form.

    Here is a similar thread:

    https://community.dynamics.com/365/f/dynamics-365-general-forum/370172/disable-new-phone-call-form-after-pressing-click-to-call-button

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Bypass Phone Call Quick Create Form

    Hello Wahaj,

    Risking being wrong by making an assumption, I think you misunderstand. I seem to have the same problem, namely the automatic creation when the Click to Call button is pressed. For me, I would like to click on the button to start our phone system with the number in CRM, but stay on the form on which the field is ( so no quick create form, or switch to a main form of the Telephone table/entity).

    Can you, or anybody help with this problem?

    Kind regards,

    Peter

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Bypass Phone Call Quick Create Form

    Hi,

    Thank you for your query.

    Depending on your need, you can opt one of these approaches:

    1 - You can set the Phone Call as read-only in the Entity Configuration. However, this way user can't create or edit the phone call (they can only see it in read-only mode). 

    Here are steps to follow:

    • Go to Advanced Settings -> Customizations -> Customize the System.
    • Expand Entities -> Phone Call.
    • Under Outlook and Mobile section, check Read-only in Unified Client option.
    • Click and Save icon and then Publish.

    pastedimage1610356349367v1.png

    • Refresh the form, now you won't see Phone Call create option.

    pastedimage1610356396350v2.png

    I guess, phone calls will be already completed in your scenario, hence users do not need to edit the Phone Call records.

    If you still think, they should edit:

    2 - Add a script on the Phone Call form to make it read-only (as suggested by Clofly) when form type is Create.

    3 - Or you can create a real-time workflow to prevent Phone Call creation. If your phone call records are create by a specific user (integration user), you can add a condition to stop creation if the user is not integration user.

    For example:

    • Create a real-time workflow on the Phone Call entity.
    • Trigger it on Create.
    • Set the following condition and stop workflow as cancelled:

    pastedimage1610357537896v1.png

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Bypass Phone Call Quick Create Form

    Hi DawnK,

    Please check whether the solution would work for you:

    Firstly we still need to disable the quick creation feature of phone call.

    Then, due to form has different types, so we can run custom javascript function at OnLoad event of Phone Call form to lock all fields when the form type is "Create":

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/getformtype 

    function disableCreate(executionContext) {
        var formContext = executionContext.getFormContext();
        var formType = formContext.ui.getFormType();
        if (formType === 1) {
    
            formContext.ui.controls.forEach(function (control, index) {
    
                var controlType = control.getControlType();
    
                if (controlType != "iframe" && controlType != "webresource" && controlType != "subgrid") {
    
                    control.setDisabled(true);
    
                }
    
            });
    
            var confirmStrings = { text: "Phone call creation is disabled.", title: "Confirmation Dialog" };
            var confirmOptions = { width: 450, height: 200 };
            Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
                function (success) {
                    if (success.confirmed)
                        console.log("");
                    else
                        console.log("");
                });
        }
    }

    e.g: After clicking the phone icon, user will navigate to phone call form, but with the code, it will show a confirmation dialog.

    pastedimage1610344751302v1.png

    All fields will be locked even if we close the dialog.

    pastedimage1610344892432v2.png

    In addition, from my test, it seems that we can still save form even if all fields are locked and required field such as subject is blank, so please register another function at OnSave event of the form to prevent saving event.

    function stopSave(executionContext) {
        var formContext = executionContext.getFormContext();
        var formType = formContext.ui.getFormType();
        if (formType === 1) {
            var subject = formContext.getAttribute("subject").getValue();
            if (subject === null) {
                var eventArgs = executionContext.getEventArgs();
                eventArgs.preventDefault();
                
                var confirmStrings = { text: "You can't save phone call with empty subject.", title: "Confirmation Dialog" };
                var confirmOptions = { width: 450, height: 200 };
                Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
                    function (success) {
                        if (success.confirmed)
                            console.log("");
                        else
                            console.log("");
                    });
            }
        }
    }

    pastedimage1610347029804v1.png

    Regards,

    Clofly

  • DawnK Profile Picture
    DawnK 90 on at
    RE: Bypass Phone Call Quick Create Form

    Thanks but I do not want any Phone Call form to open because the integration automatically

    creates a phone activity.  

    I am looking for the way to stop the phone call form to open when I click on the phone icon.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans