+ Start a Discussion

Add sharing rule to cases

Is there a way to create a sharing rule for cases that says "Share with person in field name = Contact Name"

We use cases in the marketing department so that internal people can request work from us. However, once the request comes in it gets reassigned to an internal marketing person. So now the case owner is someone other than the person that originated it.
In order to keep track of the original requestor we use the standard look up field "Contact Name" and we have all our users as part of a contact list under the corporate account.

I would like to share the cases with the person in the 'Contact Name = John Doe" 
Is this possible?
If so, how would I accomplish this?
thank you!
Tyler Mowbrey 1Tyler Mowbrey 1
Hi Mikey,

Yes this is possible. Ultimately you would need to have a lookup from User to Contact to ensure that we know which user to share to. Then, you would need to create an apex trigger on cases and based upon the contact name having a related user, create a new share for the case/user. Here is a link to a great blog post on how to create sharing reasons programmatically: http://blog.jeffdouglas.com/2009/11/25/programmatically-creating-sharing-rules-with-apex/. Let me know if you have further questions.