You need to sign in to do that
Don't have an account?
pooja biswas
untyped json data
Hi
I have a strange requirement.
I am getting data from an external websersive after making HttpCallout and I want to load the data into LeadObject, say Name , phone etc.
Json data contains many records.
The problem is the fields in standard Lead object and json data do not match
Json field name : fullname , myphone while in Lead object it is firstname , lastname etc
case 1: how to map these fields
case 2. If json data is like this: fullname=salesforce#cloud, so in lead object I want to have firstname=salesforce and lastname=cloud
How to handle this?
any inputs pls elaborate.
thanks
pooja
I have a strange requirement.
I am getting data from an external websersive after making HttpCallout and I want to load the data into LeadObject, say Name , phone etc.
Json data contains many records.
The problem is the fields in standard Lead object and json data do not match
Json field name : fullname , myphone while in Lead object it is firstname , lastname etc
case 1: how to map these fields
case 2. If json data is like this: fullname=salesforce#cloud, so in lead object I want to have firstname=salesforce and lastname=cloud
How to handle this?
any inputs pls elaborate.
thanks
pooja
Did you write the wrapper class to receive data from external web service? If not, you can write a wrapper class and map the fields.
Thank you.
I cam write wrapper class if field names match. I hope I am right.
In this case field names are different.so how it will map?
pooja
Try this
you have to change with your custom names.
I got some idea. thanks
One more point if I may ask.
I have custom webservice which comes from an external api or assume that its defined in apex controller.
In an visual force page when I click a button, How to call this webservice using javascript remoting, assuming webservice returns a parameter & also takes a parameter?
thanks
pooja
You can use Ajax Toolkit provided by Salesforce for your purpose. The AJAX Toolkit is a JavaScript wrapper around the API and can be used instead of VF and Apex.
1. Create a custom button which executes JavaScript on its click.
2. Use Ajax Toolkit to perform the operations. You can perform SOQL and DML operation in Ajax Toolkit.
You can also refer these links
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_commandButton.htm
https://andyinthecloud.com/2013/07/16/how-to-call-apex-code-from-a-custom-button/
Please mark this as best answer if this helps.
Thanks
Nabeel