xrm-mock
xrm-mock copied to clipboard
Question: FormContext and Statecode
What is the correct way to add a statecode attribute to the formContext? I have been creating string attributes as shown in the examples i.e.
const stringAttribute = XrmMockGenerator.Attribute.createString("firstname", "Joe");
Then adding them to the formContext like
context.data.attributes = new ItemCollectionMock([stringAttribute]);
If I try to create a statecode though as below
const statecode = XrmMockGenerator.Attribute.createOptionSet("statecode", 0, [
{ text: "Active", value: 0 },
{ text: "Inactive", value: 1 },
]);
I get an error about a circular reference.
Thanks, Alan