I have a visualforce page with controller class etc. everything works fine under when I login with my own salesforce account (administrator). but When I login with a sales agent account, the page would display just fine, but there are some query within Javascript file using SOAP API AJAX tool, and they no longer works. seems like a permission problem, but I have no idea how to fix the issue. is there anyway I can have the API call logged in as administrator? thanks a lot
-
1You should strongly consider using JavaScript Remoting or after Spring 14, potentially Remote Objects, instead of the SOAP API toolkit. You're basically costing yourself API calls against the daily limit with not real benefit.– joshbirkCommented Feb 24, 2014 at 21:09
-
1As soon as you load VFRemote.js on Custom Button code @joshbirk ;-)– Matt and NeilCommented Feb 24, 2014 at 21:49
-
Ha! Ok, fair enough :) Although in that case I usually redirect to a VF page, perform logic, and then return to the record (or other response). But I'll acknowledge that UI is not always what you want. You could also look into replacing it with a Chatter/Publisher action. This would have the advantage of working in S1 as well.– joshbirkCommented Feb 24, 2014 at 21:51
1 Answer
Short answer: Not really. If there's a custom Apex endpoint involved (which there usually isn not), you could see if the class is using the with sharing keyword and remove it - but that is highly not recommended. Especially in this particular use case. And it may not fix your problem.
First check to see if that user has API enabled. If they don't, there's nothing you can really do - they won't be able to hit the SOAP API. They'd need that perm.
Second see what fields the app is using and check Field Level Security against them, that is also a frequent culprit.
You can also try setting up a debug log as the (sales agent) user and see if obvious errors show up.
-
1thanks a lot. turn out indeed this particular user does not have API enabled. So I end up writing the logic in a controller class. Thanks for your help. Commented Feb 25, 2014 at 22:55