Tuesday 22 August 2017

How to call apex class from SKUID

What is SKUID

Skuid is a tool that is used to change any element of your user interface, quickly and very easily. With Skuid, you can design your user experience and it is more human and less machine process.
Skuid natively runs on Salesforce and it provides user interface same as Salesforce lightning. You can create an infinite number of the custom Skuid component without writing code.

Call Apex Class From Skuid Component

Firstly, we need to add two JavaScript URL in SKUID. To add URLS follow below steps-

Step 1 :

Go to page creation UI in Skuid then select JavaScript Icon {} to add JavaScript and then click on + icon to add (Snippet) newSnippet and select snippet and select ‘External’ in Resource Location and put Resource Name- apexJS and put ‘/soap/ajax/36.0/apex.js’ url in Resouces URL .

Now add another JavaScript URL, click + icon to add another  (Snippet) newSnippet and select snippet then and select ‘External’ in Resource Location and put Resource Name- connectionJS and put /soap/ajax/36.0/connection.js’ url in Resouces URL .
Now Save the settings.


Step 2 :

Now add another snippet to call apex class. Then create snippet with click on + icon  and click on that snippet then select In-Line(call this when you want call apex class onLoad event) in Resource Location and provide Resource Name and now double click  on snippet or click on </> icon to edit the component to add class.
Now get the data from the models then create a variable to get the result from the Class.
Add below statement in Skuid edit page to call parametrized method from class. 


var result = sforce.apex.execute(ClassName,MethodName, {parameter1:value1, parameter2:value2});

Note: Method parameter name text should be same in class and in SKUID page when calling.



Now Create WSDL class to call in SKUID.

WSDL Class

global class ClassName
{
  webservice static string methodName(String parameter1,String parameter2)
  {
      /* Your method body will be here */
  }
}

0 comments:

Post a Comment

If you have any doubts, please let me know.