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
MikeGoelzerMikeGoelzer 

Self-Service Portal User Profile

How can I get a trigger that fires in response to a self-service portal user's actions to insert a new record?  I keep getting an exception like this for SSP users when doing an insert:

EXCEPTION:..Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Owner ID: id value of incorrect type: 03530000000v8GcAAI: [OwnerId]

No other user type has this problem, and all the profiles have create permission for the object I'm trying to insert.


Message Edited by MikeGoelzer on 11-10-2008 08:00 AM

Message Edited by MikeGoelzer on 11-10-2008 08:14 AM
MikeGoelzerMikeGoelzer
This is the code that's failing:

Code:
        List<Note> notes = new List<Note>();
        notes.add( new Note( OwnerId='005300000013tJf', ParentId=c.Id, Title='INFO', Body=sDbg ) );        
        insert notes;

 I have tried both with and without the OwnerId='...' part; in both cases the result is that same exception.

werewolfwerewolf
Yes, this issue is due to the fact that the user context is an SSP User, and SSP Users can't do much.  You need to get a real user to be associated with this note, so your options are to either query for a real user (maybe the one that owns the case?) or to have one set in your setup page.
MikeGoelzerMikeGoelzer
Werewolf, thank you, this makes a lot of sense.  But one question.  In the above code snippet, I'm doing an OwnerId='005300000013tJf' to try to set the owner to a real user (005300000013tJf is a valid user in the dev org).  I still get the exception when SSP users invoke the trigger, even though this technique works correctly when invoked by other user types.

I've also tried using a hardcoded queue id; same result.

Is there something besides specifying an OwnerId=whatever that I need to do?