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? – Rahul Gawale Mar 24 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. – Nagendra Singh Mar 24 at 14:57
  • Which community license are you using? – Rahul Gawale Mar 24 at 15:00
  • regardless of License type, seems to me the right sharing mechanism here is a Sharing Set. – krigi Mar 24 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 Mar 24 at 15:10
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? – Nagendra Singh Mar 24 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 Mar 24 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. – Nagendra Singh Mar 25 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.