Roles are cleared out when a resource is updated via API
Symptoms:
Roles are cleared out when a resource is updated via API. Why is this occurring?
Reason:
ResourceFeatures and ResourceRoles fields are not populated when updating the resource.
Resolution:
Use GetById to populate ResourceFeatures and ResourceRoles fields.
These fields are under the Resource object, and if not populated they will overwrite existing role and feature assignments as per documentation:
"Update will write all data held in the Resource object including the internal objects for Address, Payroll and any Rate objects."