to put into context I have a content type for Leads. These leads are then converted into projects. I would like to make it possible for the user to be able to hit a button that then converts the lead to a project node mapping certain fields to the new node that has additional fields specific to a project.

I looked at Node Convert: Doesn't retain the original node and doesn't have addition fields for the project

Comments

nevets’s picture

As far as I know you are looking at a custom solution since the mapping is not one to one. That is the code needs to "know" how to map lead fields to projects.

CobraMP’s picture

the fields are the same, re-used definitions so mapping would be easy and straight across. Basically now it requires re-entering the same info in the same fields.

jerdavis’s picture

If the fields and data stored on each content type is the same, then I'd probably recommend looking at workflow module.

Rather than having 2 content types and converting nodes between them, just have one content type with several workflow states. The content type starts off in state "Lead" and then moves on to state "Project" when it's a go, then perhaps it moves on to state "Completed" when the work is done?

You can then make use of actions to trigger anything you want when one of these transitions occurs. So, when the node moves from Lead to Project actions trigger that send email notifications to the appropriate parties, or that enable additional fields on the content type, or that make elephants fly across the screen ;).

This would likely be a much more sustainable solution than what you're currently looking at doing.

Jer Davis
Advantage Labs, Inc.
advantagelabs.com

WorldFallz’s picture

Definitely-- this is the way to go. You can also use the content permissions module (part of core cck) to restrict permissions on the fields as they pass through the workflow and use either worklfow and/or rules to change those permissions as the workflow changes states.

CobraMP’s picture

I am currently utilizing workflow and I hadn't thought of that. I could still retain my lead data and still create stats and reports. There are addition fields required for when it becomes a project and also some lead fields that would no longer be wanted visible. I do recall a module that could hide and unhide fields based on criteria.

My initial thought on needing to convert was to retain the ability to gather statistics on the leads. I think this method would allow me to still do that. I have been using the project type for client pages but think it wouldn't take much to hide certain fields from them once it's converted.

Thanks for the tips.

CobraMP’s picture

guess I could always clone it and convert it.

here another idea I wonder if feasible. add a field to the project node that references the lead node. Then each field has a default entry with a php snippet box. could I use php to query the node refrenced in the reference box and pull the associated field data in? That would be good as the user would need only select from a list of converted leads and the projects fields would then auto populate. good as long as I could overwrite the default I guess.