Hi guys,
In this post i am showing how can we use the power of javascript in VF page and inserting record in salesforce without any standard/custom controller or Apex.
By using AJAX Toolkit we can do this task easily.
AJAX Toolkit divides in two type synchronous and asynchronous call.
It works in three simple steps:
- Connecting to the AJAX Toolkit(By using login methods or getting Session_ID)
- Embedding the API methods in JavaScript.
- Processing the results.
Screen Shoots:-
After inserting of record you are having ID of record :-
Happy Coding...:)
Thanks
Anurag Jain
Anurag,
ReplyDeleteThanks for the post!
This approach doesn't seem to comply with the MVC pattern. I'm curious to understand the pros/cons of using the AJAX toolkit for CRUD operations vs. the traditional controller-based approach. Would you mind touching on that a bit?
Thanks,
Martha
Hi Martha,
DeleteAJAX Toolkit is based on the partner WSDL and Using the AJAX Toolkit you can only calls the SOAP API, AJAX Toolkit can never make calls to the Controller methods.
AJAX Toolkit is used AJAX works best with relatively small amounts of data (up to 200 records, approximately six fields with 50 characters of data each). The larger the data set returned, the more time it will take to construct and deconstruct a SOAP message.
but using controller-based approach you can do any thing you want SOAP calls, REST calls,can play with large no of records etc.
Thanks