How to get started with BeanFactory?

I’m brand new to SuiteCRM, although I have used SugarCRM as a general user previously.

I’m currently working through the Developer docs and trying to understand how the BeanFactory works.

My understanding is that you can carry out CRUD type operations.

Could somebody please explain how to use BeanFactory. For example, I have located /data/BeanFactory.php - Do I add the code to this file?

My 2nd question: How do I execute this code once this has been added?

Thank you!

Hi @JergenH25,

Welcome to the community!!!

Well I guess you are checking the official documentation. if not here it is: https://docs.suitecrm.com/developer/

The best way to interact with the system is via logichooks custom views. There are many samples in the forum. Please ask specific questions in the forum and chances are somebody have solved your issue already and will respond to you with solutions.

Thanks @BrozTechnologies - it’s great to be here!

The link you provided is very helpful.

I forgot to say in my original post that I wanted to create an account record.

After reading the link you provided, it would be better to solve this this through API.

I will try and do this through API and postman!

API and Beans are different things. API is for integration with external systems.

The first question to know where you need to place your code is this: what triggers the account creation? Is it a button in the app? An import process? An event on an external system?

I have inserted an account with MySQL workbench which has worked correctly.

I had to use a custom Primary Key/GUID. This is likely not the preferred way.

If I used API to do the same task, would this auto generate the GUID due to Logic Hook?

Just to update the topic, in case it helps others in the future.

I solved this by using MySql and inserting directly into the database table.

To generate the id, I inserted uuid().

(So, nothing to do with BeanFactory - I had misunderstood originally)