You need to sign in to do that
Don't have an account?
Abraham kumar
Urgent POST method creation in JSON format
i just need to do a POST request containing all the contact data fields whenever a user is created or updated on Salesforce and sent to our client website database.
Please help me with class and POST method to achieve this,code on how this can be done.
Im a bit new with integration, any help highly appreciated. Please help me complete this on what needs to be done.
It is just the post method please help.
Many Thanks
Abraham
Please help me with class and POST method to achieve this,code on how this can be done.
Im a bit new with integration, any help highly appreciated. Please help me complete this on what needs to be done.
It is just the post method please help.
Many Thanks
Abraham
All Answers
Could you perhaps use Workflow's "Outbound Message"? It's not a POST but if you have more control over your client website database perhaps you could change that end to make it easier?
Otherwise you'll be looking at an APEX trigger that will fire off an @Future method to do a callout.
Can you pls tell send me the code for this trigger that will fire off an @Future method to do a callout. or maybe an sample or some reference Please. Thanks!!
Many Thanksfor your help in advance!!
Abraham
I think the outbound is a great idea, do you think when they can accept Json they can also accept xml Right?.
Although the Doc says Json
What do you think.?
Please let me know. Thanks!!
Abraham
JSON and XML are two very different formats - if they only accept JSON then the Outbound Message idea won't work. =(
What you'll do is to create a trigger on the Contact object and pass the trigger.newMap.keyset() to another class annotated with @Future - check this link for the @Future method: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_future.htm
Within the @Future class, you'll construct your JSON object - reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_json_overview.htm
Finally, you'll assemble and transmit your JSON object to the REST endpoint - reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http.htm
Start there - if you get a few classes up and humming and have problems, please come back here and post your code for review.
Good luck!
Let me start up right away... Hope ull help me if im stuck somewhere :)...
Many Thanks!!
Abraham
This is my trigger
And this is my class:-
Please can you let me know how i can test the output of this.
Im using the requestbin to get the results but im not getting any output. Please can you help me with what is my mistake. thanks a Ton!! Awaiting your response.
Thanks
Abraham
Please let me know if this code is fine. The logic is like any changes made to the email or firstname or lastname or title fields in salesforce should send all these fields along with the contact id to the external system. Im not getting any errors Im hoping its fine . only thing is i just dont know how to test it to see the output.
please help me. thanks!!
Thanks
Abraham
Im soo soo happy to hear from you.
This is the error in debug log.
pls let me know what is wrong here . Ive have added "http://requestb.in" to remote url.
Many Thanks
Abraham
You may want to wrap those encoding functions with another method that returns an empty string or the value.
Ur Amazing.. :)
Got the exact result i want..
Just one little thing it shows results as below:-
FORM/POST PARAMETERS
Id: 003L000000aeUZ5IAM
Email: integration@gmail.com
Last_Name: Int
First_Name: Test323
RAW BODYId=003L000000aeUZ5IAM&Email=integration%40gmail.com&First_Name=Test323&Last_Name=Int
Our client website database asked told me that it should be in JSON format so this would go as JSON there right. as i see the above results does not come in json format.. just bit concerned on that..
Many Thanks for making this happen
Abraham