Cannot create new relationships from studio

I have a custom module and I have several many-to-many relationships with accounts module. Everything works ok but now I need to create another relationship with accounts module again

I am trying to create it from studio but when I click on “Save and deploy” button, it seems nothing happens coming back to the studio-relationships window but you cant find the new relationship in this window

I have changed the log level to INFO and when you click on “Save and deploy” button, you can see a lot of activity in suitecrm.log so I supose something is running when I try to create a new relationship but it does not finish ok

Does anyone any idea about what is happening?

My version is 7.4.3

Thanks in advance

Your file permissions may not be set correctly.

On a Linux system set the following:

chown -R www-data:www-data .

chmod -R 755 .

chmod -R 775 cache custom modules themes data upload config_override.php

Hi!

Permissions are set ok

Actually, I can create any other relationships from the same module. The probles seems to be with the accounts module

You have probably already done this but have you tried a rebuild relationships and a quick repair and rebuild? Sometimes you have to open permissions then carry out a quick repair and rebuild then set the permissions back to what they should be before everything works.

Hi Andi,

I have just try your sugestion and the problem contiues after running rebuild relationships and quick repair

Is there a way to create this relatioship from code?

Yes there is but its complicated. Create a relationship in studio between two modules you know its working on then look in:

custom/Extension/modules/YOUR MODULE/Ext/Vardefs/

and you will see a file with a name made up of the two modules. Look in that for an example.

Here is an example of a custom relationship I created:

custom/Extension/modules/sa_AuthorizeNet_Transactions/Ext/Vardefs/sa_authorizenet_transactions_accounts_sa_AuthorizeNet_Transactions.php



$dictionary["sa_AuthorizeNet_Transactions"]["fields"]["sa_authorizenet_transactions_accounts"] = array (
  'name' => 'sa_authorizenet_transactions_accounts',
  'type' => 'link',
  'relationship' => 'sa_authorizenet_transactions_accounts',
  'source' => 'non-db',
  'module' => 'Accounts',
  'bean_name' => 'Account',
  'vname' => 'LBL_SA_AUTHORIZENET_TRANSACTIONS_ACCOUNTS_FROM_ACCOUNTS_TITLE',
  'id_name' => 'sa_authorizenet_transactions_accountsaccounts_ida',
);
$dictionary["sa_AuthorizeNet_Transactions"]["fields"]["sa_authorizenet_transactions_accounts_name"] = array (
  'name' => 'sa_authorizenet_transactions_accounts_name',
  'type' => 'relate',
  'source' => 'non-db',
  'vname' => 'LBL_SA_AUTHORIZENET_TRANSACTIONS_ACCOUNTS_FROM_ACCOUNTS_TITLE',
  'save' => true,
  'id_name' => 'sa_authorizenet_transactions_accountsaccounts_ida',
  'link' => 'sa_authorizenet_transactions_accounts',
  'table' => 'accounts',
  'module' => 'Accounts',
  'rname' => 'name',
);
$dictionary["sa_AuthorizeNet_Transactions"]["fields"]["sa_authorizenet_transactions_accountsaccounts_ida"] = array (
  'name' => 'sa_authorizenet_transactions_accountsaccounts_ida',
  'type' => 'link',
  'relationship' => 'sa_authorizenet_transactions_accounts',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'right',
  'vname' => 'LBL_SA_AUTHORIZENET_TRANSACTIONS_ACCOUNTS_FROM_SA_AUTHORIZENET_TRANSACTIONS_TITLE',
);

Then in custom/Extension/modules/Accounts/Ext/Vardefs/sa_authorizenet_transactions_accounts_Accounts.php


// created: 2016-01-28 15:15:14
$dictionary["Account"]["fields"]["sa_authorizenet_transactions_accounts"] = array (
  'name' => 'sa_authorizenet_transactions_accounts',
  'type' => 'link',
  'relationship' => 'sa_authorizenet_transactions_accounts',
  'source' => 'non-db',
  'module' => 'sa_AuthorizeNet_Transactions',
  'bean_name' => false,
  'side' => 'right',
  'vname' => 'LBL_SA_AUTHORIZENET_TRANSACTIONS_ACCOUNTS_FROM_SA_AUTHORIZENET_TRANSACTIONS_TITLE',
);

If you can understand that then add your own custom relationship between your two moduels then do a quick repair and rebuild for it to take effect.

Hi Andy

It does not work too

I did a copy of one of the other relationships that I have working ok in the same module and I modified the copy properly

I checked the relationship table in mysql and you cannot see the new one among the others