You need to sign in to do that
Don't have an account?

Getting the text value frm lookup
public class MyItemLookup{
public static void updateRelease(mt__Item_Lookup__c[] item){
for(mt__Item_Lookup__c a:item){
a=[select mt__Item__c from mt__Item_Lookup__c where mt__Item__c=:a.mt__Item__c];
String name='!{a.mt__Item__c}';
MyItem.updateRel(name);
}
}
}
Is it possible to get the text value of a lookup field ?
here mt__Item__c is the lookup field..
I have a requirement to pass the text value in the lookup field
to another apex class as a String parameter.
Please let me know if there is a way to achieve this....
Why not create a new formula field that captures the value of the lookup. For instance, if you have a lookup to Opportunity, the formula field can be a text field mapped to Opportunity Name. You can then pass this value to your Apex Class.
Hope that helps,
Sati
That is probably because your formula field is a text version of the lookup field, don't do that. Instead, the lookup displays in the web UI typically the name of the custom object, so your formula field should be comprised of that. That is why in my example, I say use Opportunity Name in the formula field, and not the Opportunity Lookup.
Hope that helps,
Sati