Menu
SuiteCRM Pull Request Party hosted by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: Relationship between tables with custom key values

Relationship between tables with custom key values 1 month 16 hours ago #82161

  • albert91
  • albert91's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Hello everybody,
I'm currently using SuiteCRM for migrating an existing database on a custom made CRM solution.

Right now I've exported each table of the old CRM in CSV and imported them in SuiteCRM. For each table I have created a custom module. Each table, in fact, refers to a separate SuiteCRM entity.

I adapted the SuiteCRM modules to the CSV columns. My problem is the connection between these tables. Each table has one or more key value to connect to another table. The key values are integers like 1-2-3-4... How could I connect the key values?

Thank you so much
The administrator has disabled public write access.

Relationship between tables with custom key values 3 weeks 6 days ago #82195

  • AlxGr
  • AlxGr's Avatar
  • Offline
  • Elite Member
  • Posts: 176
  • Thank you received: 26
  • Karma: 4
I will suggest to create a custom field to hold those IDs and then create a LogicHook to create a relationship when imported.
The administrator has disabled public write access.

Relationship between tables with custom key values 3 weeks 6 days ago #82198

  • albert91
  • albert91's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
AlxGr wrote:
I will suggest to create a custom field to hold those IDs and then create a LogicHook to create a relationship when imported.

Do you have any link or code example that could be suitable to my problem? Consider that after importing these data, I just need to keep the consistency between tables using ID's. One table can have multiple ID's connected to other tables.

Thanks!
The administrator has disabled public write access.

Relationship between tables with custom key values 3 weeks 6 days ago #82213

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 9833
  • Thank you received: 1468
  • Karma: 349
I would use a PHP importer script that uses SuiteCRM Beans to make everything work.

There is an example here: gist.github.com/pgorod/3ce7868a290df0ef4f8c9de74f12a6cd

I also recommend using the default modules, as much as possible. Instead of creating new custom modules for your entities, try to think "which SuiteCRM module looks more similar to this entity?". This will give you access to a ton of features in the existing modules.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Relationship between tables with custom key values 3 weeks 1 day ago #82546

  • albert91
  • albert91's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
pgr wrote:
I would use a PHP importer script that uses SuiteCRM Beans to make everything work.

There is an example here: gist.github.com/pgorod/3ce7868a290df0ef4f8c9de74f12a6cd

I also recommend using the default modules, as much as possible. Instead of creating new custom modules for your entities, try to think "which SuiteCRM module looks more similar to this entity?". This will give you access to a ton of features in the existing modules.

Hi Pgr,
thanks for your response. Right now the database I'm importing is almost totally different. It's based on Area/Streets/Building, but it doesn't contain any geographical data like PostGIS. By the way, each table contains many data that cannot be found in the default models.

For example: most of the tables have ID numbered in progressive order, Name of the street, ID of the building, and many other data like check box of 0/1 or names.

How could I import everything in SuiteCRM? Your option would be interesting, but I don't understand the full potential.
Last Edit: 3 weeks 1 day ago by albert91.
The administrator has disabled public write access.

Relationship between tables with custom key values 3 weeks 17 hours ago #82548

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 9833
  • Thank you received: 1468
  • Karma: 349
This is complicated to explain generically, but it goes something like this:

- understand the SuiteCRM data model the best you can, and read about manipulating data with Beans objects: docs.suitecrm.com/developer/working-with-beans/

- add some custom fields to the default modules to include some extra data you have

- understand that SuiteCRM IDs don't have any other requirement, other than being unique. You can use your existing IDs.

- write the script to load data into modules, and build the relationships as it goes along

- include Security Groups (who can access what) in your design

Of course it's ok to use entirely new modules where necessary. But all the work of tying them up with the rest of the product will have to be done by hand, so do it only if it's really necessary, and you have the ability to do so.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Relationship between tables with custom key values 2 weeks 5 days ago #82594

  • albert91
  • albert91's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Ok thank you so much.

Until now I've just tried to import data via CSV with import function, but I were not able to keep the relationship as in the previous database.

I will try in the new way you told me to do.
The administrator has disabled public write access.
Time to create page: 0.038 seconds
Powered by Kunena Forum