+91-9953024688
           

Monthly Archives: November 2018

fetch the dependent picklist value – UI API in APEX salesforce

To Fetch the dependent Picklist value: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_picklist_values.htm   /ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}/{fieldApiName} objectApiName—The API name of a supported object. recordTypeId—The ID of the record type. fieldApiName—The API name of the picklist field on the object. public class FetchPicklist { public list<DependentValues> getValidPicklistOptionsFromDependencyMatrix(String standardObject, Id recordTypeId, String DependentFieldName, String selectedValue) { List<DependentValues> dpnPckLst = new List<DependentValues>(); String url = ‘callout:REST_UI_API/services/data/v43.0/ui-api/object-info/’+standardObject+’/picklist-values/’+recordTypeId+’/’+DependentFieldName; if(String.isNotBlank(getCalloutResponseContents(url))) { Map<String, Object> response = (Map<String, Object>)JSON.deserializeUntyped(getCalloutResponseContents(url)); Map<String, Object> controllerValues = (Map<String, Object>)response.get(‘controllerValues’); //System.debug(controllerValues.get(selectedValue)); //Checking if the controller values consists of the specified key if(controllerValues.containsKey(selectedValue)) { //Getting all the data in values property of the JSON response, i.e., the dependent picklist values List<Object> pickListValues = (List<Object>)response.get(‘values’); System.debug(‘:: pickListValues :: ‘+pickListValues); String valuesStr = JSON.serialize(response.get(‘values’)); System.debug(‘:: […]

Nube Lead Infoventure Pvt Ltd