Lucas Famelli
Lucas Famelli

Reputation: 1615

How to make a lead have multiple opportunities on SugarCRM 6.3 CE?

I need to make a lead convert (and relate to) 1 or more opportunity on SugarCRM. With just one lead it's easy, I just have to set the 'opp_id' field - however, with multiple leads I'm not able to do that.

I need at least to create a relationship 1:n between Leads and Opportunities, and to fill that relationship with PHP code (receiving both lead and opportunity ids).

Any ideas?

Thanks.

Upvotes: 2

Views: 1262

Answers (1)

frosty
frosty

Reputation: 769

What I would do is create a one to many relationship between Leads and Opportunities in Studio, what this does is creates a relationship table that will be called something like leads_opportunities (or opportunities_leads depending on what table is the LHS, I think). This will also create a subpanel, the Opportunities can be added to lead via the Select or Create option on the Subpanel. If you want to create multiple relationship straight from the Lead screen, you could add a number of Opportunity relate fields. With the after_save logic hook, you could check for the existence of that specific Lead/Opportunity combo (since there isn't a multi-field index on the relationship tables) and write it if it doesn't exist. It depends more what the use case requirements are, but that should give you an idea of how to handle it a couple different ways...

Upvotes: 2

Related Questions