In Previous Example , have explained how to do REST API separately with XML and separately with JSON. if we want to create both in same class and when third party use either of these to call from salesforce how we can create apex in salesforce explaining in this blog post. For this first we … Continue reading REST API with XML and JSON Both in Same Apex Class
REST API with XML&JSON for Request and Response in Salesforce
In Previous Example I created records using Post Method from workbench. Now from this blog post am explaining how to do create record using xml/JSON with RestAPI using work bench. Go to workbench -> Rest explorer -> Select Post radio button.and give the URL something like this ==> /services/apexrest/v1/AccountMgmt/ as per your url mapping in … Continue reading REST API with XML&JSON for Request and Response in Salesforce
HTTP Status Codes (Success, Error Etc.)
Either when an error occurs or when a response is successful, the response header contains an HTTP code, and the response body usually contains: The HTTP response codeThe message accompanying the HTTP response codeThe field or object where the error occurred (if the response returns information about an error) The error code is a special … Continue reading HTTP Status Codes (Success, Error Etc.)
Apex Test Class for Apex Triggers
Before deploying a trigger, write unit tests to perform the actions that fire the trigger and verify expected results. Let’s test a trigger that we worked with earlier in the Writing Apex Triggers unit. If an account record has related opportunities, the AccountDeletion trigger prevents the record’s deletion. Apex Trigger trigger AccountDeletion on Account (before delete) { … Continue reading Apex Test Class for Apex Triggers
Apex Test Class for Batch Apex
Batch Apex is used to run large jobs (think thousands or millions of records!) that would exceed normal processing limits. Using Batch Apex, you can process records asynchronously in batches (hence the name, “Batch Apex”) to stay within platform limits. If you have a lot of records to process, for example, data cleansing or archiving, … Continue reading Apex Test Class for Batch Apex