You need to sign in to do that
Don't have an account?
Ralf Wittenberger
Trigger to autofill a lookup field on account with Grouping ID
Hi,
I need to have a lookup field on Account to be filled with Grouping ID upon creating or converting a Account.
Unfortunately, it is not possible to do this with a workflow, so i guess, writing a Trigger oder Code would be the easiest way here, right?
There is another condition for a specific field, if this is filled with specific content.
So, formular, I would have written like:
If(And(isnew(),ispickval(country_responsible_for_account__c,"Germany")),a0fD00...,null)
Is there anyone out here, that can help me with that?
Thanks a lot in advance for your help
PS: is there anything, you can recommend to learn how to write trigger etc?
I need to have a lookup field on Account to be filled with Grouping ID upon creating or converting a Account.
Unfortunately, it is not possible to do this with a workflow, so i guess, writing a Trigger oder Code would be the easiest way here, right?
There is another condition for a specific field, if this is filled with specific content.
So, formular, I would have written like:
If(And(isnew(),ispickval(country_responsible_for_account__c,"Germany")),a0fD00...,null)
Is there anyone out here, that can help me with that?
Thanks a lot in advance for your help
PS: is there anything, you can recommend to learn how to write trigger etc?
trigger SetCustomerGrouping on Account ( before insert) {
for (Account a: Trigger.new)
{
if(a.country_responsible_for_account__c == 'BCA Germany'&& a.Top100__C ==null){
a.Top100__c ='a0fD0000008iqQZ' ;
}}}
All Answers
Please check the below code where the lookup field is autofilled.
Its quite similar to your requirement.
please follow the below link for more information on this code
http://salesforce.stackexchange.com/questions/35254/autopopulate-lookup-field-with-account-id-using-an-apex-trigger
Best Regards
Naga Kiran
trigger SetCustomerGrouping on Account ( before insert) {
for (Account a: Trigger.new)
{
if(a.country_responsible_for_account__c == 'BCA Germany'&& a.Top100__C ==null){
a.Top100__c ='a0fD0000008iqQZ' ;
}}}