How can I query the user id/id's of the Partner User belonging to the Partner Account? Can you provide me with the approach/sample.

I have a below query that fetches the id of the Partner Account from the Opportunity ( There is a lookup relationship added to the opportunity)

    Id, Name, AccountId, Commisioning_Partner_Account__r.Id,
FROM Opportunity

The scenario is : if at all there is any Partner User belonging to the Partner Account, the partner user should have access to that opportunity. In a nutshell, I want to open the access of the opportunity to the Partner User of the Partner Account. Is it possible through Apex Sharing trigger?

  • Not an answer but I recommend changing Commisioning_Partner_Account__r.Id to Commisioning_Partner_Account__c. It may save you some headaches down the road. – Adrian Larson Feb 3 '15 at 16:52

As i understood Commisioning_Partner_Account__r.Name is a contact field and if its contact field then you can query userId of partner account by email address.

[SELECT id, email from USER where email =: "email of contact field" AND profile = "Partner profile name"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.