Set Relationship Field Using Sugar Formula

Hello Folks,

I have two relationship fields in my Opportunities module - one with contacts and another with a custom module (Industry).

Now, I want to populate custom module relationship field based on selected contact. Is there any way we can do this using formulas. I know, we cannot do it from Studio as it is relationship and it won't show up in Studio as a field but is there any way we can do it from vardef.

Scenario is: 

Contacts module has one relate field - industry. I need to fetch that field and set it in relationship field (Industry).

I wrote formula for non-db relationship name and relationship id fields like:

'formula' => 'related($contacts, "industry_id")'; and

'formula' => 'related($contacts, "industry_name")'; but this is not working.

Any suggestion would be appreciated.

Regards.

Hats.