No 'Access-Control-Allow-Origin' header is present on the requested resource

  • 1
  • Question
  • Updated 3 years ago
I have a very basic requirement. Take inputs from the user (as of now trying to take only one input) and insert the value in a custom object. 

Following is the JS code:-

var applicationModel = skuid.model.getModel('Application');var applicationRow = applicationModel.data[0];
var result = sforce.apex.execute('ApplicationMasterController','checkPassedValueFromPage',
{
appFromSkuid: applicationRow
}
);

The ApplicationMasterController just has 2 lines of code viz.

webservice static String checkPassedValueFromPage(customObject appFromSkuid) {    
    return 'tested the flow from Skuid Page';
    }

the method does return the string but on the browser console there is an error which states "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://c.cs6.visual.force.com' is therefore not allowed access."

I have even tried whitelisting the link. but does not help.

Any pointeres for this issue  and Is there any other way to achieve this requirement other than what I have tried??


Regards,
Gautam.
Photo of Gautam Kasukhela

Gautam Kasukhela

  • 100 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Hi, Gautam,
This is just a guess, but did you reference the AJAX toolkit as an external resource in your Skuid page. It's an extra step needed in order to call an Apex webservice method from your Skuid page, and you may have already done this. If you haven't, add a new JS resource of type "External Resource" and use this as your Resource URL:
 /soap/ajax/[latest_api_version]/apex.js (for example,  /soap/ajax/34.0/apex.js ). That might fix the problem for you. Also, this community post has some great information on different ways to call Apex from Skuid.
https://community.skuidify.com/skuid/topics/calling_apex_function

Hope that helps!
Emily