You need to sign in to do that
Don't have an account?
khillan bhardwaj
Hi,
I want to retrieved dependent picklist value.I am able to do it by javascript. but i need to use in trigger. In trigger you know we can not excute javascript.
If any one have sample code to get depenedent picklist(either Schema or MetaData Api) values please let me know.It is urgent.
Thanks
Getting dependent picklist values by Apex
Hi,
I want to retrieved dependent picklist value.I am able to do it by javascript. but i need to use in trigger. In trigger you know we can not excute javascript.
If any one have sample code to get depenedent picklist(either Schema or MetaData Api) values please let me know.It is urgent.
Thanks
Please see the below sample code:
And also follow this link :
http://blog.deadlypenguin.com/blog/2012/07/09/dynamic-dependent-picklists-in-salesforce/
public with sharing class ProductUtils {
static public List<Product__c> getAllProducts(Boolean includeEOL) {
//This is done since the formula field cannot return a boolean
Integer currentlySupported = (includeEOL) ? 0 : 1;
return [
select Name
from Product__c
where Currently_Supported__c >= :currentlySupported
order by Name
];
}
public static List<Product__c> getAllProducts() {
return getAllProducts(false);
}
public static List<Version__c> getAllVersions(Id productId, Boolean includeEOL) {
Integer currentlySupported = (includeEOL) ? 0 : 1;
return [
select Name,
Product__c
from Version__c
where Currently_Supported__c >= :currentlySupported and
Product__c = :productId
order by Name
];
}
public static List<Version__c> getAllVersions(Id productId) {
return getAllVersions(productId, false);
}
}
Best Regards
Naga Kiran
I hope this helps you -- the developer who found this forum question in a search!