xrm-mock icon indicating copy to clipboard operation
xrm-mock copied to clipboard

Question: FormContext and Statecode

Open DSTAlan opened this issue 2 years ago • 0 comments

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

DSTAlan avatar Apr 04 '22 10:04 DSTAlan