The problem The main problem with getting picklist based on recordtype, there is no "out of box" solution. You can easly fetch all values from picklist but without information about recordtypes. The solution You need use "User Interface API", not very elegant solution, but it works. Give more time Salesforce for implement such obvious functionality (the idea arose only 8 years ago). /ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}/{fieldApiName} Step by step: public static String innerSalesforceCallout(String serviceEndpoint) { if (String.isEmpty(serviceEndpoint)){ return null; } Http http = new Http(); HttpRequest webReq = new HttpRequest(); webReq.setMethod('GET'); webReq.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId()); webReq.setEndpoint(serviceEndpoint); try { HttpResponse res = http.send(webReq); } c...
Comments
Post a Comment