function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
beefy911beefy911 

changing ownerid on case object causing errors

This doesn't work:

 

trigger cdAssignment on Case bulk (before insert) {
...snip...
for (case c : trigger.new){
if (c.RecordTypeId == rtRequest)
{
// c.OwnerId = requests.get(c.Request__c).OwnerId;
}
else if (c.RecordTypeId == rtPaymentR)
{
// c.OwnerId = paymentRequests.get(c.Related_Payment_Request__c).OwnerId;

system.debug(c);
// below is a valid id that i used to test and it still fails
c.OwnerId = '005700000014h0xAAA';
system.debug(c);
}
}

}

This works:

 

trigger cdAssignment on Case bulk (before insert) {
...snip...
for (case c : trigger.new){
if (c.RecordTypeId == rtRequest)
{
c.custom__c = 'blah blah...';
}
else if (c.RecordTypeId == rtPaymentR)
{
c.custom__c = 'blah blah...';
}
system.debug(c);
}

}

 

Here's a snipplet of my code, the initial user creating the case is a portal user and once they click submit it should change the owner to an internal user of my choosing. But right now it is giving me an error:

 

Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

 

I can save and make changes to any field on the case object besides OwnerId. Here are some things I tried:

- Giving the profile create/read/write permissions to that object

- Double check that the field accessibility was set to Editable for that recordtype

 

I don't know where else to look, does anybody have any suggestions?

Manu ErwinManu Erwin

hi,

did you ever figure out the reason for this?

 

I'm experiencing the same problem and am tearing my hair out.

 

Enabling the "Transfer Cases" permission for the Profile works however I'd prefer to not provide this functionality if I can help it.