You need to sign in to do that
Don't have an account?
Chris Fisher
Cross Refence Custom object with custom lead field.
Hi All,
I am trying to work out a way to populate a customer lead field by cross reference with a customer object, i will be doing this in APEX code as i believe its not possible as a workflow.
Situation
We are using apex classes to create lead records using information sent into salesforce from a webserver.
SO, the apex code populates the below custom field
lead.abicode__c = 1234567
We then want lead.abigroup to update. As there is a large number of abicodes we have created a custom object ( abigroups16062014) and this contains around 30000 records showing two bits of information:
EG:
abigroups16062014.code = 1234567
abigroups16062014.group = 27
What i want to happen is when the lead is created, i would like a piece of code that will allow lead.abigroup__c to be populated with the corresponding group number from the custom object.
so
find abigroup16062014.code where .code = l.abicode__c
then
l.abigroup__c = abigroup16062014.group
Does this make sense?
I am trying to work out a way to populate a customer lead field by cross reference with a customer object, i will be doing this in APEX code as i believe its not possible as a workflow.
Situation
We are using apex classes to create lead records using information sent into salesforce from a webserver.
SO, the apex code populates the below custom field
lead.abicode__c = 1234567
We then want lead.abigroup to update. As there is a large number of abicodes we have created a custom object ( abigroups16062014) and this contains around 30000 records showing two bits of information:
EG:
abigroups16062014.code = 1234567
abigroups16062014.group = 27
What i want to happen is when the lead is created, i would like a piece of code that will allow lead.abigroup__c to be populated with the corresponding group number from the custom object.
so
find abigroup16062014.code where .code = l.abicode__c
then
l.abigroup__c = abigroup16062014.group
Does this make sense?
Why not create a lookup field to the abigroups object on the lead object? This can be populated at the same time as the lead is created. You can do a soql query to find the relevant abigroup.
This will then create a relationship between the two records and If you still need the code and group on the lead you can create formula fields and grab is from the related abigroup.
By using this approach, if the group or code changed, the values in the lead record will be updated automatically
Something like:
All Answers
Why not create a lookup field to the abigroups object on the lead object? This can be populated at the same time as the lead is created. You can do a soql query to find the relevant abigroup.
This will then create a relationship between the two records and If you still need the code and group on the lead you can create formula fields and grab is from the related abigroup.
By using this approach, if the group or code changed, the values in the lead record will be updated automatically
Something like:
Let me know how you get on.
Where l.Abi_group__C = lookup relation with the custom object.
Does that look correct?
"Invalid type l.abi_group__c" would i be right in thinking thats decause its a text box and the abicode__c is a number box?
Note the change on line 1, you were giving the matchingGroup variable an invalid type
Got there in the end: