SuiteCRM 8: How can i create record based on another module

Hey Guys,

I want to Link products to account whenever someones creates contract against that account and add products in it(Line Items).

(I know how to do it in SuiteCRM 7 through logic hooks but stuck in SuiteCRM 8)

Your help will be appreciated!

Have you tried to do it using workflow? I think logic hook should work in the v8.x too :thinking:

No, Logic hooks not working

@pgr Can you help please?

Is there anyway i can achieve it through workflows?

I am not sure if it can be done with Workflows, because Products module is a bit more complex, with Line Items etc.

But by creating records in the several modules and adding relationships, you might be able to get it working. The logic hook is more complex because you have to be a PHP developer (or hire one), but for these purposes it would be much simpler to achieve because you can just code everything directly.

Thanks for the response @pgr, in which modules i’ll have to create records?

Have you read about relationships in the SuiteCRM. Maybe you could create one-to-many relationship between accounts and products. It will create subpanel under the modules.

@Hamza you can do your changes in the UI and keep an eye on the database to see what is created there, and then try to emulate that.

Definately want an on save hook here. When you save a contract you basic logic is going to be:

Get the account id

Loop through the products on the contract to get the product ids (this will be in line items I think, I’ve never done contracts, but I’ve done this in the past with quotes)

Loop through the prodcuct id’s to populate the relationship between the products(line items) and the account id

Getting the right relationship name, is where I always have problems, so make sure you look at the account bean and find the right account-product relationship name.

I don’t see any reason why this wouldn’t work in SuiteCRM 8. It’s all back end logic that should be the same as SuiteCRM 7.