0

Scenario : Account and Contact both are private for external users.

A user (A) from community creates a new contact and an email is triggered to the contact for registration flow.

The registration flow opens up with a guest user profile and contact started registration and a portal user (B) is created.

Now when the new user (B) is created and when he logs in to digital experience, he is not able to modify his contact because the contact owner is user (A).

In this case there are few options,

  1. update the contact owner to User (B)
  2. create a group and share the user to that group (in that group only one user will be there).
  3. create a share record ContactShare with userId as User (B) and Contact Id as the contact id, and ContactAccessLevel as 'Edit'

I am going for 3rd option, but not sure of the pitfalls in that. Also this needs to happen programmatically so option 1 seems impossible.

6
  • Do you want to keep the record accessible to both user A and B? Commented Mar 24, 2021 at 14:48
  • User A should have read access and user B should have read/write both. But logically the access should be revoked from User A and granted to User B. Commented Mar 24, 2021 at 14:57
  • Which community license are you using? Commented Mar 24, 2021 at 15:00
  • regardless of License type, seems to me the right sharing mechanism here is a Sharing Set.
    – krigi
    Commented Mar 24, 2021 at 15:07
  • also to OP, if it is a requirement that user (A) not have visibility to the Contact they created, you could use a simple auto-launched Flow running in System Context to change Ownership.
    – krigi
    Commented Mar 24, 2021 at 15:10

1 Answer 1

1

It can be simpler than all that, you should use a Sharing Set. The Access Grant would be:

  • Object = Contact
  • Access Determined By = User:Contact = Contact:Id
  • Access Level = Read/Write
3
  • I see that profile selection is an option, if I dont specify a profile then will that work? Commented Mar 24, 2021 at 15:52
  • Sharing Sets are bound to Profiles. I suggest that you review documentation and explore in a sandbox to understand how this feature works.
    – krigi
    Commented Mar 24, 2021 at 15:58
  • This works, but as its dependent on Profile, the only drawback is that it that we cannot send this in a managed package, because the profiles may change in sponsors org. Commented Mar 25, 2021 at 4:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .