Get a URL parameter from a Visualforce page String MyParameter = ApexPages.currentPage().getParameters().get(‘urlparm’); Get a map of URL parameters from a Visualforce page Map UrlParameterMap = ApexPages.currentPage().getParameters(); // check for a specific parameter if (UrlParameterMap.containsKey(‘urlparm’)){ //do something with the parameter… UrlParameterMap.get(‘urlparm’) } Get URL Parameters in a Visualforce page This assumes the URL is looks like…
Read moreCategory: Apex
Salesforce Apex programming language
Apex Loops, The Simple Things
For loop over a map’s keys (KeySet) map MyAwesomeMap; //… other code for (String KeyStr: MyAwesomeMap.keySet()){ system.debug(KeyStr); } For loop over a map’s values map MyAwesomeMap; //… other code for (CustomObject__c AnObject: MyAwesomeMap.values()){ system.debug(AnObject); } For loop over a list list MyAwesomeList; //… other code for (CustomObject__c AnObject: MyAwesomeList){ system.debug(AnObject); } For loop over a…
Read moreCode Snipits for Converting Salesforce Collections
Convert a Map to a List of keys Map MyMap = new Map(); List IdList = new List(); // … logic to load map … IdList.addAll(MyMap.keySet()); Convert a Map Values to a List of values Map MyMap = new Map(); List CustomObjectList = new List(); // … logic to load map … CustomObjectList.addAll(MyMap.values()); Convert an…
Read more