You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{describe,it,expect,beforeEach}from"vitest";import{XrmMockGenerator,OptionSetAttributeMock,ItemCollectionMock}from"xrm-mock";describe("Issue 82",()=>{beforeEach(()=>{// Initialize XRM MockconstXrm=XrmMockGenerator.initialise();});it("FormContext and Statecode",()=>{constcontext=XrmMockGenerator.getEventContext();constformContext=context.getFormContext();conststatecode=XrmMockGenerator.Attribute.createOptionSet("statecode",0,[{text: "Active",value: 0},{text: "Inactive",value: 1},]);// Add statecode to form attributesformContext.data.attributes=newItemCollectionMock([statecode]);// Confirm it is correctly addedconsole.log(formContext.data.attributes.get("statecode").getValue());// Output: 0});});
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
I get an error about a circular reference.
Thanks, Alan
The text was updated successfully, but these errors were encountered: