javascript remoting in popup

  • 1
  • Problem
  • Updated 4 years ago
  • Not a Problem
I am using sforce.apex.execute to call a remote service endpoint (this is within a sf community).  If I access the skuid page as a full page (with headers), then the remote call works as expected.  However, when displaying this page in a a vf popup page which includes the skuid:page component, the remote call fails with a 500 error.  

I notice that the service address being called when it fails is not correct.  This is the endpoint being called: https://dataclover.force.com/services/Soap/package/CampaignWizard
It should be ...force.com/auto/services...  Now, if I enabled showHeader='true' on the apex:page so the headers how up within the popup, then the remote call works.  However, this obviously isn't desirable since I don't want that visual aspect.

I do have the latest version installed since that was needed to fix an issue with page includes from the community.  I also cloned the three pages required for properly using the skuid:page component.
Photo of Edward Taupier

Edward Taupier

  • 180 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Edward Taupier

Edward Taupier

  • 180 Points 100 badge 2x thumb
I was able to work around this issue using a @RemoteAction method on the controller.  I never did figure out how to get the webservice approach to work.  I don't think this is really related to skuid; it's more a product of trying to use the webservice inside a headerless page in a salesforce community.
Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
Hi Ed, I've never tried a WebService call within a Community before, but it's very strange to me that the Service URL would be different with showheader="true". There must be some Salesforce JavaScript code that's loaded by the Header which sets the Service URL correctly, which is not getting run without the header.

I'm glad you got it to work with the @RemoteAction -- this is our recommended approach anyway, because it does not consume API calls.