Use either active or inactive as value for a.state

SetStateDynamicEntityRequest a = new SetStateDynamicEntityRequest();

a.Entity = new Moniker();

//Primary key of record

a.Entity.Id = new Guid("{AAD5DA71-34E3-DB11-90D0-0003FF873FE6}");

a.Entity.Name = "new_customentity";                  

a.State = "inactive";

a.State = "active";

a.Status = -1;

service.Execute(a);

 

 

NOTE! there is a bug in assoicated views on custom entities making inactive records to be displayed in grid.
This has been fixed as seperate hotfix and are included in update rollup packet 1 and timezone fix.