You need to sign in to do that
Don't have an account?
Andegosu
Autopopulate/suggest record based on Contact address
We have nonprofit asssociations that are responsible for different areas in Sweden. When I create a new contact in lightning I want the association field to be autofilled or suggested for the user with the corresponding association based on the Contact's postalcode.
We will have a table with each association and their respective postalcodes. So based on the postalcodes in this table I want to suggest a association for the contact that has a corresponding postalcode.
Is this possible? I'm not sure how to implement this requirement and would be grateful for some assistance.
We will have a table with each association and their respective postalcodes. So based on the postalcodes in this table I want to suggest a association for the contact that has a corresponding postalcode.
Is this possible? I'm not sure how to implement this requirement and would be grateful for some assistance.
You can also use after trigger.
to getting the data about 16000 Postal code we should go for the batch class which help us to get records easily.
and According to me map will help full for us
because of below line
"ass.get(c.PostalCode)"
will return name of association according to postal code.
As i say above to get the data about postal we use batch apex class and a method which return data of postal codes.
And
i have another method which also help full for you I think this code is help for you
and my this code is not exact as you think this is only demo
All Answers
we need to write before insert trigger on contact object.
I am writing simple logic of that implementation.
I don't think the before trigger would allow us to get a suggestion when creating the contact? So after you filled in the postalcode you get a suggestion for the appropiate association. Sorry for being unclear about this.
Also I'm not sure a map would work, in your example you are doing a get on postalcode so the postalcode would have to be the key (first param of the map) and not the value. Sweden has over 16000 postal codes that would have to populate a map everytime you create a contact which would take some time.
You can also use after trigger.
to getting the data about 16000 Postal code we should go for the batch class which help us to get records easily.
and According to me map will help full for us
because of below line
"ass.get(c.PostalCode)"
will return name of association according to postal code.
As i say above to get the data about postal we use batch apex class and a method which return data of postal codes.
And
i have another method which also help full for you I think this code is help for you
and my this code is not exact as you think this is only demo