Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to initialise global object #36

Closed
charliechen179 opened this issue Jun 26, 2019 · 1 comment · Fixed by #40
Closed

Unable to initialise global object #36

charliechen179 opened this issue Jun 26, 2019 · 1 comment · Fixed by #40

Comments

@charliechen179
Copy link

Hi,

When l try to get the example running, I have an error on initialising the global object. When do I miss?

image

Thanks

@camelCaseDave
Copy link
Owner

Hi @charliechen179 thanks for your feedback.

You're right - the documentation was outdated.

xrm-mock will default entityName to contact, so all you need to write is:

XrmMockGenerator.initialise();

If you want to specify a specific entityName, you can pass an object:

XrmMockGenerator.initialise({
    entity: {
        entityName: "account",
    },
});

See

it("should default entity name to contact", () => {
XrmMockGenerator.initialise();
const expected = Xrm.Page.data.entity.getEntityName();
expect(expected).toBe("contact");
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants