1
votes

I'm having issues with Microsoft Dynamics CRM Online 2016 and the Bing Maps control. When a user creates a new record with the Bing Maps control on the form, once they save the form with the required fields and composite address field filled with a valid address, the Bing Maps isn't refreshing. Why not?

I realised that if I navigate away from the record (to a different area of CRM) and then back again to the record before the Bing Map control will populate for the first time. But I need this is done at least when the user fills the required field and saves the record. I also realised that if I refresh the web browser (via F5 or the refresh button) this Bing Maps control is not working on my form. (I mean, I see the map but the Bing Maps isn’t refreshing).

Do you guys know a way to refresh the Bing Maps control the first time the user enters a valid address and saves the record on Dynamics CRM?

1

1 Answers

0
votes

Is there a script attached to your form? If so, add this code to the script and it should work (make sure that Form_onsave is enabled in the Form Properties). This will reload the page after the form is saved, so hopefully it will suffice. I have not come across a way to reload the map without reloading the entire page, but thankfully the reload is quick.

function Form_onsave(){
    // save form data to prevent "unsaved data" warning
    Xrm.Page.data.entity.save();

    setTimeout(function () {
        // save form data
        Xrm.Page.data.entity.save();
        // reopen current page
        Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());
    }, 3000);
}

EDIT: Also, the reload only needs to take place the first time the address is saved. From that point on the Bing map will automatically update when the "save" button is clicked. So, I'd change the code to only reload the form if the field was null and is now populated.