fake-xrm-easy icon indicating copy to clipboard operation
fake-xrm-easy copied to clipboard

Disable Systemuser with SetStateRequest but empty IsDisabled field?

Open michaelmittermair opened this issue 5 years ago • 4 comments

I tried to test my controller, which is using the SetStateRequest to disable a user. But using this request, the field "isdisabled" won't be set in the faked context.

var request = new SetStateRequest { EntityMoniker = userReference,

            //Sets the user to enabled.
            State = new OptionSetValue(1),
            // Required by request but always valued at -1 in this context.
            Status = new OptionSetValue(-1)
        };

Is there a way to set this field, without modifying the controller itself?

michaelmittermair avatar Mar 29 '19 06:03 michaelmittermair

Hi @michaelmittermair , do you mean the "isdisabled" is a property of the systemuser entity that does not get updated after calling that SetStateRequest message?

jordimontana82 avatar Jun 20 '19 07:06 jordimontana82

Hi, yes thats correct. I disabled a user in my testenvironment and loaded the properties. There the readonly-property "isdisabled" is set for the user: 2019-06-24 06_49_03-

Using the faked service, that property doesn't exists: 2019-06-24 07_00_47

michaelmittermair avatar Jun 24 '19 05:06 michaelmittermair

Great, thx for your feedback

jordimontana82 avatar Jun 24 '19 07:06 jordimontana82

I guess, mainy because SetStateRequest is just a wrapper for the update message, we could look at introducing like a proxy class that would add specific fields based on the create / update message, based on the entity your're updating, the DefaultEntityIntitializer might be a candidate for that. This could be probably part of #149

jordimontana82 avatar Jun 24 '19 07:06 jordimontana82