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
ryanhcaryanhca 

Will a NoAccessException be thrown when Unlicensed users attempt an action within a Managed Package?

We have a trigger on the Account object that's part of a managed package.

 

If an unlicensed user edits something on the account page, I'm getting a general System.Exception exception saying that an object doesn't have an 'Id' field... 

 

Wondering two things:

  1. Can I wrap all of the contents of my trigger in a try/catch statement to prevent this error, and
  2. Can I use a System.NoAccessException to catch this so that other exceptions are handled differently?
Best Answer chosen by Admin (Salesforce Developers) 
ryanhcaryanhca

I don't think this is a bug... Just something I wasn't clear on...

 

I found the UserInfo.isCurrentUserLicensed() method. It looks like what I'm looking for, but I haven't been able to test it out. If it works, I'll post back here.

All Answers

dburkidburki

Hi,

 

I am from salesforce. Could you please email me at dburki@salesforce.com with more details about your problem so that we can troubleshoot it?

 

Dileep

 

ryanhcaryanhca

I don't think this is a bug... Just something I wasn't clear on...

 

I found the UserInfo.isCurrentUserLicensed() method. It looks like what I'm looking for, but I haven't been able to test it out. If it works, I'll post back here.

This was selected as the best answer
SrinuSrinu
Hi Dileep,

I am getting an error while submitting opportunity to approval process.

I did a post in discussio boards. I didn't get any reply. Can you look into to it?

http://boards.developerforce.com/t5/Apex-Code-Development/Error-when-submitting-opportunity-for-approval-failing-after/td-p/699847

any suggestion would be helpful !!

Thanks & Regards,
Srinu