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
LaurentDelcLaurentDelc 

No access to an object JUST after creating it

Hi,

 

Our problem is quite simple but I'm puzzled:

- we have a class that uses With sharing

- it is used as a Customer portal user

- it creates a contact

- Directly afterwards if I try to retrieve the same contact, I get a QueryException

 

We have set up public sharing of the Contact object to public read/write and we have read/edit/create in the Customer portal profile for the Contact object.

 

Any idea?

 

Cheers,

Laurent

 

Best Answer chosen by Admin (Salesforce Developers) 
LaurentDelcLaurentDelc

You are probably very right atorman. It seems that what we are trying to do is just impossible, which is quite funny as you need a contact to send an email.... I love this link between APEX and CRM objects >_<

 

We decided to remove with sharing on this controller as we didn't find any other solution.

 

Cheers

All Answers

BrendanOCBrendanOC

Is the Contact being created successfully? Can you post the Query Exception message and the relevant Apex code snippet?

atormanatorman

I thought the customer portal handled contacts differently so that unless the portal user is a super user, it can't see the contact and even then, it needs to be parented by the same account as the contact/user creating it.

LaurentDelcLaurentDelc

You are probably very right atorman. It seems that what we are trying to do is just impossible, which is quite funny as you need a contact to send an email.... I love this link between APEX and CRM objects >_<

 

We decided to remove with sharing on this controller as we didn't find any other solution.

 

Cheers

This was selected as the best answer