
File -> New -> Apex Class -> Name it “ ApiCallLightningComponent” -> OK. Step2 – Create a New Class which will use this VF page to get the Session Id and making API Call Out. Step1 – Open Developer Console, File -> New -> VisualForce Page -> Enter Name “ GetSessionIdVF” -> OK. In this tutorial we will use VF page for making callout because it is an easy and simple method method. I gone through with this error and found THIS SALESFORCE DOCUMENT where they have specified why we can not make API Call from JavaScript Code.Īfter reading the document, I have come up with 2 Solutions that are given below: –ġ – Connected App and Named Credentials as Callout Endpoints and Auth ProvidersĢ – Using VF Page – VF page will be used to get the Session Id of the current log in user and this VF page will be used into Apex class for fetching the Session Id.
#CONVERT STRING TO LIST APEX SALESFORCE CODE#
bug('# Response Status Code '+resp.getStatusCOde()) īut if you will call the same block from the Lightning Component then you will get “ INVALID_SESSION_ID:This session is not valid for use with the API.“ Error.

bug('# Response Status '+resp.getStatus()) Req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/data/v41.0/query?q=Select+Id,+Name+From+Account') Req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId()) INVALID_SESSION_ID:This session is not valid for use with the API.įor Example when you will execute the below code from the Developer Console then you will get the Valid Response If you do make the callout from the lightning component then you will get the below error Signature public static String valueOf(Integer integerToConvert. Example:- Integer myInt Integer.valueOf('1234') valueOf(integerToConvert) Returns a String that represents the specified Integer. As in Java, the String is interpreted as representing a signed decimal integer. You may have heard about that we can not make the Salesforce API Call directly from the lightning component. Returns an Integer that contains the value of the specified String. Here is a Link to Trailhead module which explains everything about secure coding guidelines with the practical example So, In order to develop the application which is secure and minimize the risk of data compromise or any other confidential information a developer must need to keep the following points into the mind while developing the application Security Review: – The second step after submitting the code to the checkmarx and resolving all the issues is to Submit the package for the security review where salesforce representatives check the Quality of the code and functionality as well.
#CONVERT STRING TO LIST APEX SALESFORCE FREE#
I was able to use the below code and I was able to print the decimal values you can try checking this.

]ĬSV to JSON Array - An array of CSV values where the CSV values are in an array, this method will split the string using provided regex. Of the remaining fields, also known as an hash table or associative array.

CSV to JSON - array of JSON structures matching your CSV, nested JSON via column headers, and JSONLines (MongoDB) modeĬSV to Keyed JSON - Generate JSON with the specified key field as the key value to a structure.Choose from the following 5 JSON conversions offered by this tool:
