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 Service forum

Error when attempting to call WebAPI from solution configuration

(0) ShareShare
ReportReport
Posted on by 25

I'm attempting to call a WebAPI method from some JavaScript on the configuration page of my solution. This is a somewhat stripped down example

window["ENTITY_SET_NAMES"] = window["ENTITY_SET_NAMES"] || JSON.stringify({
        "account": "accounts",
        "contact": "contacts"
    });
    function save() {
        console.log("Saving");
        try {
            var Xrm = Xrm || window.parent.Xrm;
            var contactId = "8553DA63-11C9-E711-A824-000D3AE0CB84";
            Xrm.WebApi.retrieveRecord("contact", contactId, "$select=contactid,firstname,lastname").then((e) => { console.log(e); }).fail((e) => { console.error(e.message); });
            Xrm.WebApi.createRecord('account', { 'firstname': 'Bill', 'lastname': 'testerson' }).then((e) => { console.log(e); }).fail((e) => { console.error(e.message); });
        } catch (ex) {
            console.error(ex);
        }
        return false;
    }

When I attempt to run this I get an error

this.$5F_1 is null configuration.html:52:145

Any idea what I could be doing wrong? How should I be doing this? The error is pretty obscure looking

I have the same question (0)

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans