+ Start a Discussion
surya kanadhipatlasurya kanadhipatla 

Community user(profile) not able insert the case team member using trigger(getting exception)

Hi All, Good afternoon...

We have implemented a trigger to associate case team memebers to a case created via communities..
This trigger works fine for internal users but when users with community user profile creates a case its throws following error:
Op:Insert|Type:CaseTeamMember|Rows:1
System.DmlException: Insert failed. First exception on row 0; first error: OP_WITH_INVALID_USER_TYPE_EXCEPTION, Operation not valid for this user type: []
I have verified community user profile does have read/write access to case object and able to create the cases as well.
Even tried without sharing key word still exception.Observed the exception when caseteammember is inserted.
If i comment out the insert caseteammemebr line in trigger helper class no exception and case was created without case team members...

Any Help will be appreaciated...
Best Answer chosen by surya kanadhipatla
surya kanadhipatlasurya kanadhipatla
Hi Rahul,
How about changing the case owner to a full license user and try adding the case team?

Any way we have assignment rules which kicks in after that and case owner changes again accordingly....


Waiting for your reply to see any side effects....

All Answers

Rahul SharmaRahul Sharma
I too faced exact same issue, Problem was CaseTeamMember is not accessible or writable by Community users.
Abhishek_DEOAbhishek_DEO
You may create a without sharing class and put the code(inerstion) there.Call that class inside the trigger. Its just an Idea and have not tested it bit it may help you to overcome the limitation
surya kanadhipatlasurya kanadhipatla
Thanks Rahul and Abhi for replies...

@Rahul, you are right but is there any work around?How did you resolve it?

@Abhi,I tried WithOut sharing but did not work (It could be the reason Rahul mentioned above).Looking for other work arounds..

We have already raised SF support case, but they are far behind us...:)
Rahul SharmaRahul Sharma
I had used: 1. Sharing set to share all cases under an account its contacts with read write permission. 2. Using Case Contact Role to hold additional users to whom we need to give access. 3. Overridden case edit page with vf page to allow case creator or contact under contact role to edit cases. Other wise show error. I was only able to get it working with this. Thanks, Rahul
surya kanadhipatlasurya kanadhipatla
Thanks Rahul,
I want to take this route if SF support does not provide any other solution(work around) and let you know...

Much appreciated...
Rahul SharmaRahul Sharma
It would be really great if there could be a better solution. Thanks, Rahul
surya kanadhipatlasurya kanadhipatla
Hi Rahul,
How about changing the case owner to a full license user and try adding the case team?

Any way we have assignment rules which kicks in after that and case owner changes again accordingly....


Waiting for your reply to see any side effects....
This was selected as the best answer
surya kanadhipatlasurya kanadhipatla
changing the case owner to a full license user and try adding the case team worked!
Marcel dos SantosMarcel dos Santos
Hi Surya.

I'm trying to add the community user contact to a case team when the user writes a comment to an existing case. I'm getting the same error saying that users with the community license can't insert CaseTeamMember objects.
That is a restriction in the CaseTeamMember object. I don't understand how changing the case Owner could change that. In our Salesforce organization, case Owners are always either support members or a queue.
Do you know any way to insert the CaseTeamMember as a community user?

Thank you.