Skip to main content

Hello everyone

This is my very first post here.

 

Not sure if it is ok to just throw a question here, so I hope you can help me or put me in the right direction. 

 

This is the situation

Our Accounts have a parent-child (Customer-Location) schema.

The Account object has 2 custom fields int CustomerId and int LocationId. On a Customer, the CustomerId corresponds to its Id.

On a Location, the CustomerId corresponds to its Parent.CustomerId and LocationId is its Id.

We have a layout to create new locations.

You can fill in some fields and choose its parent (Customer) from a list.

 

Now, the Location needs to inherit a few values from its parent. Let's say the Account.CustomerId__c. The Location.CustomerId__c by default needs to take its parent's CustomerId__c value. So, that the user does not need to go look for the CustomerId and type it in.

 

My question:

Is there a way I can assign that value to Location.CustomerId__c when the Parent is selected from the list?

 

That before saving the new Location Account for the first time.

 

Thank you

0/9000