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

[@types/xrm] version 9.0.60 #61760

Open
feiry opened this issue Aug 17, 2022 Discussed in #61759 · 0 comments
Open

[@types/xrm] version 9.0.60 #61760

feiry opened this issue Aug 17, 2022 Discussed in #61759 · 0 comments

Comments

@feiry
Copy link

feiry commented Aug 17, 2022

Discussed in #61759

Originally posted by feiry August 17, 2022
Hi,

I found problem with Xrm.Events.EventContext.
When I try to set the parameter type to Xrm.Events.EventContext on an event i.e. onLoad(context: Xrm.Events.EventContext)
I always get 0 attributes when calling formContext.data.entity.getAttributes().getLength();
Or iterate the attributes with formContext.getAttribute().forEach((attribute index))
Or iterate the attributes with formContext.data.entity.attributes

It's working properly if I don't strongly type the parameter i.e. onLoad(context)

It's only the attributes that not working, all the rest is working perfectly.

code example (not working):

`
static async onSave(context: Xrm.Events.EventContext): Promise {
const formContext = context.getFormContext();

    formContext.getAttribute().forEach((attribute, index) => {
        console.log('attribute', index, attribute.getName(), attribute.getValue());
    });
}

`

working:

`
static async onSave(context): Promise {
const formContext = context.getFormContext();

    formContext.getAttribute().forEach((attribute, index) => {
        console.log('attribute', index, attribute.getName(), attribute.getValue());
    });
}

`

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

No branches or pull requests

1 participant