locked
Web Resource Call to Bing Maps Failing - Worked in Early Versions RRS feed

  • Question

  • Firstly, I am positive this code used to work in CRM 2011 and do not know if it stopped working with the 2013 update or the 2015 update.

     

    An html web resource uses javascript to call out to bing maps and displays information on the map in proximity to the address.

    The line of code that is actually getting the address is failing.

    accounts = Crm.GetRecords("Account", null, userFilter, null, null, null);

     

    I am not sure if 'getrecords' is a function that depends on included files or if it is a function that is available automatically by creating a web resource in crm.  I should note that the web resource in question includes several files and the file below does reference 'getrecords' (see bolding).

      : ../Scripts/crm.common.js" type="text/javascript" (part of file)

        return {         GetRecord: _retrieve,         GetRecords: _retrieveMultiple,         GetRelatedRecords: _retrieveRelated,         GetRecordByUrl: _retrieveByUrl,         CreateRecord: _created,         UpdateRecord: _update,         DeleteRecord: _delete,         CopyRecord: _copy,         GetRelatedRecordsWithFilter: _retrieveRelatedWithFilter,         AssignRecord: _assignRequest,         OpenWindow: _openCrmWindow     }; } ();

     

     

    The map itself displays : "The specified credentials are invalid.  You can sign up for a free developer account at http://www.bingsmapsportal.com"

     

    And my developer key is still active and is type "Basic / Not-for-profit"

     

    Recommendations, fixes?


    Wednesday, February 17, 2016 10:10 PM

All replies

  • Hey,

    can you share the _retrieveMultiple code

    what you pasted in your OP was the return object.


    Elie

    Wednesday, February 17, 2016 10:30 PM
  • Sure.  These rest calls are something I am not 100% familiar with, but I know it worked in 2011.  I'll look there as well.

     var _retrieveMultiple = function (entityName, columns, filter, callback, orderby, errcallback) {
            var async = !!callback;
            var setName = entityName + 'Set';
            var _callback = callback;

            filter = (filter) ? "&$filter=" + filter : '';

            var query = serverUrl + ODATA_ENDPOINT + "/" + setName + "()" + "?";
            if (columns != null) query += "$select=" + columns.join(',');
            if (orderby != null) {
                if (columns != null) query += '&';
                query += "$orderby=" + orderby;
            }
            query += filter;

            var performRequest = function (query, fnCallback) {
                var async = !!fnCallback;
                var options = { url: query }

                return _doRequest(options, async, function (data) {
                    var next = data.__next || null;
                    var results = data.results || data;
                    var response = { 'results': results, 'next': next }

                    if (next) { // enable eage loading
                        response.LoadNext = function (callback) {
                            return performRequest(next, callback);
                        };
                    }

                    if (async)
                        fnCallback(response);
                    else
                        return response;
                }, errcallback);
            };

            return performRequest(query, callback);
        };

    Thursday, February 18, 2016 2:13 PM