Relate field and relationships between modules

Hi guys! I have a question : is it possible to create a relationship when i choose from relate field? For example i have a module A and relate field in it to module B. And when i choose something , can i make a relationship automatically?
p.s. i know that relationships are created via studio, but it’s not very useful to work with subpanels in my case

Help pleeease

I’m not sure I understand exactly your scenario, but if you want to code things in php, yes, you can create relationships from the beans.

Example code creating a relationship from a new Contact to an Account:
// get Bean for pre-existing Accountt:
$account = BeanFactory::getBean(‘Accounts’)->retrieve_by_string_fields(array(‘name’=> ‘SomeAccount’));
$someContact->load_relationship(‘accounts’);
$someContact->accounts->add($account->id);

Is this what you were looking for?

Thanks for your answer!
Actually, when in Module A i choose sth in related field to module B, for example, i want to see in a subpanel of a item of module B item of module A.

You want to customize a view or a subpanel; there are several ways of doing this: overriding Display function, or setting up a hook (see http://www.jsmackin.co.uk/suitecrm/suitecrm-list-view-conditional-formatting/).

Then you can use the Beans to navigate from the current record to a related record and get the information you want to display.

I suggest buying Jim Mackin’s book on SuiteCRM to get all the information you need. Get it from that site that I linked to above.

Thank you! To be honest, now i can’t afford buying this book, it’s quite expensive for russian ruble :frowning: