Clearing userUpdatedFields to "Reset" AdminGroups and Roles


#1

We had to make several manual adjustments to AdminGroups and Roles and have since made these part of the c3Customer repository.

To properly test these and ensure we have full consistency between environments, we believe we need to clearUserUpdatedFields for the AdminGroups and Roles prior to deploying a release so the Platform doesn’t see those and exclude them from provisioning, thereby leaving the manually edited roles to persist.

Three questions:

  1. The function for AdminGroups that I have is the following; please confirm:
    AdminGroup.clearUserUpdatedFieldsBatch(AdminGroup.fetch({limit: -1}).objs)
  2. Is there a similar function for Roles?
  3. Would it be better to provision/deploy with a -r (“reset”) parameter than run this/these prior to the deployment?

Thank you,


#2

I have not seen -r successfully overwrite user updated fields.


#3

@sam.winans I’m confused by your question. AdminGroup mixes in SeedData and the userUpdatedFields is the mechanism by which provisioning ignores manually updated fields, thus leaving the manual edits intact. This seems to be what you want. Clearing the userUpdatedFields would therefore cause all of the manual updates to be lost during provisioning.

Role is a different case. It mixes in Metadata, not SeedData and that means that during every provisioning, the entire set of Roles will be entirely replaced (ones that no longer exist will be removed and any updates to those that remain will be lost). This is the expected behavior for Metadata types and therefore, manual updates should not be applied unless they are also made in the json metadata).

I don’t believe “-r” should remove userUpdatedFields for SeedData types as most (if not all) times it is used, it is meant to completely refresh the metadata, which has nothing to do with user updated SeedData. If we want that capability during provisioning, we should add a separate option.


#4

Thank you, Tom and Sean.

We have made the formerly manual updates in the c3Customer repo (replaced workarounds with corrected long-term fixes) so what I’m trying to say is that I think we do need to remove these manual updates prior to upgrading. That way, when we provision, we can be sure that the AdminGroups and Roles are setup exactly as the lower environments were where we performed our testing.

If we do not do this clearing and we deploy to Prod AND there were manual edits/workarounds in Prod, then we’d now be up against having to manually track and undo the workarounds and handle manually each time we deploy thereafter.

Does this make sense?

Thanks again,


#5

Tom’s response solves this. Thanks,