Extending Opportunity to include Person template

I would like to extend opportunities to include name, address and email fields. but not sure of the best way to go about it.

Is it possible to add the following

require_once __DIR__ . '/../../include/EmailInterface.php';

class Opportunity extends Person implements EmailInterface

to custom\modules\opportunities\opportunity.php ?

Why aren’t you just adding the fields in Studio? what is your requirement exactly?

Our process usually starts with an opportunity, not a lead. And we need to record the name, email address and primary and alt addresses for the new project.

At the moment, we are having to create the lead record and then convert that into an opportunity. I am trying to eliminate this step and record the details straight into an opportunity; and subsequently prepare a quote and THEN convert that opportunity into a contact and project. We will still have leads, and be able to convert them into an opportunity, but the process generally starts at opportunity stage.

I’ve tried creating the name and address fields in studio, but they lose much of the functionality, such as copying the address over, and having the full name displayed properly.

I overcome this with the primary and salt address fields, but again ran into the same problem with the first and last name not being concatenated into ‘full_name’ etc.

I then started to think it would be better if i could simply extend the opportunity module so that it had the ‘person based’ fields built in.

I don’t see how that Extension would work, you would still have to go looking for all the extra “glue” code.

Have you tried adding the same fields that are in Leads, but from the vardefs, instead of from Studio? This might let you use some more peculiar field types. You might still need some extra code but it shouldn’t be too much.

thanks pgr, im working through adding the fields in vardefs - which is a start, but as you say im realising there’s lots of glue to find and re-apply.

1 Like