Module Relationships Removing/Deleteing

I have created several relationships that are not needed and have created sub-panels. I would like to remove these relations to clean up my installation and modules. I have three different “Documents” I need to remove 2 of the three. See attached.

Have you tried searching for this? I remember seeing posts explaining how to delete relationships manually…

Three weeks ago there was a similar post, but nobody answered that post either.

There is this one

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/9512-cand-delete-relationship-in-account-between-my-custom-module-no-delete-button#33792

but I never tried that, so use at your own risk. I suppose it also clears any other changes made in Studio.

But I know there are other, more complete, answers, like this one:

You should first delete two files:

    Metadata file:
    custom\metadata\~relationship_name~MetaData.php

    TableDictionary file: custom\Extension\application\Ext\TableDictionary\~relationship_name~.php

Now you have to remove fields from both related modules:

    custom\Extension\modules\~first_module_name~\ext\vardef\~field_name~.php
    custom\Extension\modules\~second_module_name~\ext\vardef\~field_name~.php

P.S: Remember to backup before deleting any files

Make sure you have the proper backups in case you break anything accidentally

I would love to thank the admin that was a great “help”. SuiteCRM does have a built in way to clear relationships. It is an all or nothing approach. If you enter the Studio then the module, there is a reset button. You then can choose what portion of the module you would like to reset. If you use this method you will need to recreate the relationships you need. You do not need to reset the entire module, just the portion you need.

Interesting, I just learned something new. I had never entered that area of the app. Thanks

If you don’t want to reset all relationships for a module you can also delete them one at a time. (assuming they are relationships created in using studio)

  1. Go to: Admin > Studio > (your module) > Relationships
  2. At the bottom of the relationship list will be the relationships created in studio marked with an *
  3. Click on the relationship you want to delete.
  4. Click the delete button.

Note you can ONLY delete relationships added to the module with studio this way. A default module relationship will not have a delete button.

It appears not all custom-created relationships will show up there. I have some I know are non-default that don’t provide that option.

Was the custom relationship created using Studio interface (after the module was deployed) or by modifying the code manually?

Only relationships created using Studio will give you the delete option in Studio. If a relationship was created using Studio it will have an * after the name.

In Studio, but I think after doing a quick repair and rebuild, that is what gets rid of the asterisk and makes it non-deleteable. We just restored from a backup, but annoying that there is no simple delete button for custom-created or default relationships. Any program that has an “add” function should have a “delete” function.

I can’t replicate the behavior as I am able to add a relationship in Studio, do a quick rebuild, and then delete it. Must work in some cases and not in others. Still, something to try before resorting to more powerful measures such as deleting files, resetting the entire module, or restoring a backup.

I has the same problem where custom relationships have been created, then exported and loaded over time that the system did not display the Delete button.

I did the following:

Open modules\ModuleBuilder\tpls\studioRelationship.tpl

Change this section by commenting out the { if …} and {/if}.

{*  {if $hideLevel < 3 && ($rel.from_studio || !$rel.readonly && !$is_new)}  *}
    <input type='button' name='deleterelbtn' value='{$mod_strings.LBL_BTN_DELETE}' onclick='ModuleBuilder.deleteRel()' class='button'>
{*  {/if} *}

In this way the Delete button will always appear in Studio and you can let the module builder delete the relationship for you.

Care taken deleting the correct relationships (I guess the reason it is hidden is to make sure the default relationships are not deleted) and then I uncommented the lines above.

1 Like