Showing posts with label Workbench. Show all posts
Showing posts with label Workbench. Show all posts

Tuesday, October 1, 2019

How to view deployed components in salesforce using Workbench

This post explains how to view deployed components using the workbench.

  • Login to workbench
  • Select Production/Sandbox(based on your preferences)
  • Give your login credentials and give allow access to a workbench
Then select "Metadata Process API Status"
It asks the AsyncProcessId then get you deployment Id
Then select Deploy and click on the Get Status button, it returns the deployed metadata components in org.



Wednesday, December 19, 2018

How to Read REST API GET Parameters in Apex

This post explains How we can read the REST API GET parameters in Apex
We can read the parameters based on URL

Example:1

URL: /services/apexrest/getContactdetails?accountId=Accountd&leadSource=Web
Rest Method: GET
Demo:
@RestResource(urlMapping='/getContactdetails/*')
global class RESTServiceDemoClass {
    
    @HttpGet
    global static list<Contact> getContactList() {
        String strAccId = '';
        String strLeadSource = '';
        list<Contact> lstCons;
        RestRequest restReq = RestContext.request;
        RestResponse restRes = RestContext.response;
        // Reading parametrs from URL
        strAccId = restReq.params.get('accountId');
        strLeadSource = restReq.params.get('leadSource');
        if(!String.isBlank(strAccId) && !String.isBlank(strLeadSource)) {
            lstCons = [Select Id, Name, Email FROM Contact WHERE AccountId =:strAccId AND LeadSource =: strLeadSource];
        }
        return lstCons;
    }
}
above class return the list of contacts based on passing parameters accountId and lead source
Example URL
/services/apexrest/getContactdetails?accountId=0017F00000idCUi&leadSource=Web
Result:

Example: 2

URL: /services/apexrest/getContactdetails/Accountd&Web
Rest Method: GET

Demo:
@RestResource(urlMapping='/getContactdetails/*')
global class RESTServiceDemoClass {
    
    @HttpGet
    global static list<Contact> getContactList() {
        String strAccId = '';
        String strLeadSource = '';
        list<Contact> lstCons;
        RestRequest restReq = RestContext.request;
        RestResponse restRes = RestContext.response;
        // Reading parametrs from URL
        strAccId = restReq.requestURI.substring(restReq.requestURI.lastIndexOf('/') + 1);
        strAccId = strAccId.left(strAccId.lastIndexOf('&'));
        strLeadSource = restReq.requestURI.substring(restReq.requestURI.lastIndexOf('&') + 1);
        if(!String.isBlank(strAccId) && !String.isBlank(strLeadSource)) {
            lstCons = [Select Id, Name, LeadSource FROM Contact WHERE AccountId =:strAccId AND LeadSource =: strLeadSource];
        }
        return lstCons;
    }
}

Example URL:
/services/apexrest/getContactdetails/0017F00000idCUi&Web
Result:



Let Us know if you have any queries.
Happy Learning!!

Wednesday, September 26, 2018

How to Check Your Org Governor Limits Using Workbench

If you Need to Check The Your Org Total Governor Limits
Follow Below Steps

  • Login to Workbench
  • Select Production/Sandbox(Based On your Preferences)
  • Give your Login Credentials and Give Allow Access To Workbench
  •  On the Jump to picklist select "REST Explorer"
  • Click "Select"
  • From the options presented select:  /services/data/vXX.0/limits
  • Click "Execute"
EX: /services/data/v43.0/limits

Demo:

When clicking on the link, it will open the Page looks like below image

Once you login to the Salesforce
Select "REST Explorer" From Jump List
Click on Select
Select "Get" Method and Click On Execute Button
Result Will LOOK Like this


Let us know If you have any queries.
Happy Learning!