Skip to main content

Hello All,
I need to be able to to call our Apex Classes in Salesforce  but to do so I have been informed that I need to create an Apex Class that can act as a REST endpoint for a Skuid Data Source.

Here is our current process using a VF page being triggered by a button on the Account record.  This process is pulling data(JSON) from a SQL Server and displaying it on a VF page. 

·        
Controller Class – called from Visualforce page

·         Url Class – builds url and appends Account record field end of url. Calls encryption class

·         Encryption Class – Encrypt url using AES256bit encryption

·         Header wrapper Class – Define data structure for Header record

·         Detail wrapper class - Define data structure Detail records


I have Classes that build my URL and grabs the data.  Is there a way to just call the Controller Class?  Or am I approaching this all wrong?  I guess what I am thinking is that I could utilize my existing Classes which may be incorrect.

JDEWebServiceJDEService is the name of the remote site configured in SF.


If anyone could assist with what the class this would be great. We really would like to use Skuid but we need to get over this hurdle. Thanks, Michael

Not sure who told you that you needed to do anything with REST API. That is taken care of with Skuid out of the box.

You should be able to access your apex class methods by making them invocable.



Thank you for the reply Vachon. So I have an Apex Controller that calls the other Apex Classes. Do I need to add the @InvocableMethod annotation to all of the classes or just the Controller?

Thanks

Michael


Not sure I understand what you’re trying to do. Do you want to connect Skuid to a external JD Edwards REST API?


Yes, a call needs to be made to a JDE server.  Skuid will need to be triggered within Salesforce on an Account record.  Currently there is a custom button on the Account Record.  When triggered the button opens a VF page.  The VF page calls a Controller which also references additional Classes.  These other Classes are used to build and encrypt the url, wrapper classes for the data, and encrypting the url. So what I was asking is do I add the  @InvocableMethod annotation to just the controller class?  The JDE server is looking for an encrypted string so I cannot make a direct call to the server.  That is why I am trying to call the Apex classes.
Thanks for your help.
Michael


Yup. This is beyond me for sure. I don’t have the VF or Apex skills to properly answer this if these skills are necessary.

I’m still not sure I understand why you need to use Apex and VF at all if what you are trying to do is connect via to an external data source via REST API. If so, Skuid Data Source functionality would be all you need.


Ditto. You could also make the classes a RestResource to expose them but not sure where Skuid is coming into this. 


Skuid to use it’s Data Source functionality to connect to external REST API, if external REST API is what we’re talking about.


Michael,

Are you trying to replace your VisualForce page?  I am still not clear what your goal is.  Are you trying to show Orders and Order Lines for the given Account?

Based on what you described you have built, I think you can add the @invocable annotation to your URL class.  Add 1 parameter for the AccountId.  You should be good after that.  In Skuid you will be able to use an Action step to call the invocable class and pass in your account Id.

How do you plan to get the data back from JDEdwards?  You’ll need your class to return the response and have a snippet to parse this into a model.  If JDEdwards has a REST API, it seems like you can follow Pat’s proposal to configure Skuid to connect to the JDEdwards end point and load your model directly instead of needing Salesforce Apex.

Thanks,

Bill


Thank you all for your input.  Bill, yes I am trying to replace the VF page.  The VF and Apex classes is how we retrieve and display the JDE data today.  We want to be able to utilize Skuid to display the data.  The issue is that the JDE server is running a web service that is looking for an encrypted connection string which is done via one of the Apex Classes. There is code to parse the JSON data.  Should I consolidate all the code to a single Class? If I can pass the Account Id I am assuming i can also obtain a key field off the Account record also?
Thanks,
Michael


Michael,

I would add a separate class to handle the @Invocable and send request and send the response back to your page.  You can add as many parameters as you need and getting them from your account record in skuid is easy.  When you setup your data source action step to Salesforce, you can pass in your fields using the ‘merge’ syntax (i.e. {{$Model.Account.data.0.account_key__c}}).

Since you have code to parse the JSON, you’ll be set to use this data to load your model for display.  Unless you need to save this data, I would setup a UI Only model to hold the data coming back from JDE.

Thanks,

Bill


Reply