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

  • 1
    You 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. – joshbirk Feb 24 '14 at 21:09
  • 1
    As soon as you load VFRemote.js on Custom Button code @joshbirk ;-) – bigassforce Feb 24 '14 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. – joshbirk Feb 24 '14 at 21:51

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.

| improve this answer | |
  • 1
    thanks 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. – user3088377 Feb 25 '14 at 22:55

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.