TransWikia.com

Dynamic Picklist values based on RecordType selection in VisualForce page

Salesforce Asked on October 4, 2021

I have a requirement to show dynamic picklist values based on recordType. I did my research but looks like nothing native from Apex can handle this.

I went the route of calling Describelayout method via AjaxToolkit but always returns an empty array. Not sure if that’s supported anymore?

Workbench Describe

One Answer

You can get the values using describeLayout method available in Ajax Toolkit. I tried with below code and I am able to get the picklist values based on the record type. There are two RecordTypes "Author" and "Publisher" and have different values in picklist Country__c. You can find the result in the screenshot.

var result =  sforce.connection.describeLayout('sarojkbera__Book__c');
console.log(result);

Browser console screenshot:

enter image description here

Answered by Saroj Bera on October 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP