Function to assign a Potential to a Contact automatically

Function to assign a Potential to a Contact automatically

Hello.

I have some forms integrated with CRM, so every submitted form creates a new potential.

In the potential, I have "Main Contact" field, so I need a Function to assign the potential to the "main contact" automatically. 

So, imagine that I have an account name "ONE". 
This company submitted a form, that creates a new potential in my CRM. This potential, is directly created under this account "ONE", but I need to assign the main contact of this account to this potential.

Could someone develop a function to make this work? My idea is to create a workflow rule as follow:

If create/edit Potential &
the account name is "ONE"
updated the field "main contact" (and I need to select which one is).

Thank you!