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 ?
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....
Yes, you can use the relationship to get the Name field of the related object.
I am taking a guess here, but you could try something like this:
select mt__Item__r.Name from mt__Item_Lookup__c where mt__Item__c=:a.mt__Item__c
Here is documentation on handling SOQL Relationships in Apex
Here is documentation on SOQL Relationships
Lastly, I recommend moving the query outside the for loop. Otherwise, you will execute a SOQL query per iteration of the loop, and therefore might exceed the maximum number of queries allowed within apex.