You need to sign in to do that
Don't have an account?
Eric Blaxton
How do I typecast Lookup(user) value to a picklist
Hi and thanks in advance.
Problem: I have a custom object that uses a Lookup (user) field. I need this field in order to email a related user. The problem is this field does not show up on reports. So I created a picklist intending to populate the field from the Lookup, when either created or edited.
How do I typecast or convert the value of a Lookup field to a picklist value. Here is my trigger:
trigger Reg_Request_to_Reg on Registration_Requests__c (after insert) {
List<Registration__c> newRegistration = new List <Registration__c>();
for (Registration_Requests__c reg : trigger.new) {
Registration__c newReg = new Registration__c();
newReg.Inside_Sales_Rep__c = reg.Inside_Sales_Rep_Name__c; // Inside_Sales_Rep__c = Picklist / Inside_Sales_Rep_Name__c = Lookup
newReg.Inside_Sales_Rep_Name__c = reg.Inside_Sales_Rep_Name__c;
newRegistration.add(newReg);
}//end for
//try {
insert newRegistration;
// }
// catch (DmlException e) {
//System.debug('The following exception has occurred: ' + e.getMessage());
// System.('The following exception has occurred: ' + e.getMessage());
// }
}//end trigger
Problem: I have a custom object that uses a Lookup (user) field. I need this field in order to email a related user. The problem is this field does not show up on reports. So I created a picklist intending to populate the field from the Lookup, when either created or edited.
How do I typecast or convert the value of a Lookup field to a picklist value. Here is my trigger:
trigger Reg_Request_to_Reg on Registration_Requests__c (after insert) {
List<Registration__c> newRegistration = new List <Registration__c>();
for (Registration_Requests__c reg : trigger.new) {
Registration__c newReg = new Registration__c();
newReg.Inside_Sales_Rep__c = reg.Inside_Sales_Rep_Name__c; // Inside_Sales_Rep__c = Picklist / Inside_Sales_Rep_Name__c = Lookup
newReg.Inside_Sales_Rep_Name__c = reg.Inside_Sales_Rep_Name__c;
newRegistration.add(newReg);
}//end for
//try {
insert newRegistration;
// }
// catch (DmlException e) {
//System.debug('The following exception has occurred: ' + e.getMessage());
// System.('The following exception has occurred: ' + e.getMessage());
// }
}//end trigger
If this helps,please mark this as best answer to help others :)
All Answers
Thanks.
Is that possible?
If this helps,please mark this as best answer to help others :)
Regards