Reset value of "Relate To" field based on drop down selection

Hi Team,

I have two "Relate To" field in the Contact module, one is my custom module "Distributor" and one default "Account" ("Rename to Investor") module. I have one custom drop-down "Related To" in which I have two values "Investor" and "Distributor".

When I select "Related To" as "Investor", I have to show "Accounts" relate field and when I select "Distributor" I have to show "Distributor" related field.

I have used the below two formula to show and two dependent fields.

For Distributor relate field  --- 'isInList($related_to_c,createList("Distributor"))';

For Accounts relate field    --- 'isInList($related_to_c,createList("Accounts"))';

Now it is hiding and show relates field as per "Related To" selection but the problem is it is not resetting the previously selected value in any one of the related fields.

For Example :

First I select "Relate To" called "investor", selected investor records from the pop-up drawer and then I re-select "Relate To" and now select "Distributor". Now again I select "Investor" in "Relate To" the previous selected "Investor" value showing by default.

Please find the attached screenshot.

Thanks,

Rupesh Ranjangaonkar