Answered by:
CRM 2011: How to Populate Opportunity with the Contact created from Lead

Question
-
Hello,
I was wondering if anyone could point me in the right direction. I am trying to populate Opportunity with the Contact that was created from Lead from the Lead Conversion Process. If it matters, the field on Opportunity is custom and called Sponsor. I want Sponsor to be populated with the Contact that was created from Lead automatically, whether thru the Lead Conversion Process or from a workflow or from a jscript function.
Has anyone done this? I'm thinking it has to involve the Originating Lead field on Opportunity to refer back to the Lead, but on Lead there is no Contact lookup for that created Contact.
Also, I'm not sure whether to handle this from a Web Resource standpoint or from a Workflow.
If any one has done this or has some ideas, I would appreciate it.
Wednesday, August 10, 2011 7:17 PM
Answers
-
Aha, a nice workflow challenge..
To do this, you need to update the lead after the conversion has happened with the resulting contact that is created so that workflow on your opportunity can pull this contact down into your 'Sponsor' lookup. You have to deal with the fact that the lead will be de-activated so your workflow must re-activate the lead, update it, then de-activate it when one. Finally, your oportunity workflow must wait until the contact created by the lead conversion has been updated to the lead recod before continuing to update the opportunity 'sponsor'. Here's how to achieve your goal:
ok, first of all, you need to make some customisations to your lead. Add a lookup field to your lead and call it something like 'Converted Contact'.
Create a workflow on the contact entity with the following pseudo code:
Fire on create.
If <lead source contains data>
Change record status to <originating lead> an active status
Update: originating lead <populate your new 'converted contact' with the contact that the workflow is running against>
Change record status to <originating lead> to qualified
End Succeeded
Otherwise
End Cancelled
Create another workflow on the opportunity entity with the following pseudo code:
If <opportunity: originating lead contains data>
WAIT until originating lead : Converted Contact contains data
Update Opportunity: Sponsor with originating lead:Converted contact
End Succeeded
Otherwise
End Cancelled
You may want to hide/remove the 'converted contact' lookup from the lead form and also hide the 'leads' from the navigation pane on the contact form just to tidy things up but that shoud do the trick.
Rob
Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011- Proposed as answer by Rob BoyersEditor Wednesday, August 10, 2011 9:35 PM
- Marked as answer by Donna EdwardsMVP Thursday, August 18, 2011 2:39 AM
Wednesday, August 10, 2011 8:41 PMAnswerer
All replies
-
Or what I was thinking of editing the XML file of the Lead Conversion because there is functionality in there that links the Account to the Opportunity. Use that functionality to link the Opportunity to the Contact.Wednesday, August 10, 2011 7:22 PM
-
Aha, a nice workflow challenge..
To do this, you need to update the lead after the conversion has happened with the resulting contact that is created so that workflow on your opportunity can pull this contact down into your 'Sponsor' lookup. You have to deal with the fact that the lead will be de-activated so your workflow must re-activate the lead, update it, then de-activate it when one. Finally, your oportunity workflow must wait until the contact created by the lead conversion has been updated to the lead recod before continuing to update the opportunity 'sponsor'. Here's how to achieve your goal:
ok, first of all, you need to make some customisations to your lead. Add a lookup field to your lead and call it something like 'Converted Contact'.
Create a workflow on the contact entity with the following pseudo code:
Fire on create.
If <lead source contains data>
Change record status to <originating lead> an active status
Update: originating lead <populate your new 'converted contact' with the contact that the workflow is running against>
Change record status to <originating lead> to qualified
End Succeeded
Otherwise
End Cancelled
Create another workflow on the opportunity entity with the following pseudo code:
If <opportunity: originating lead contains data>
WAIT until originating lead : Converted Contact contains data
Update Opportunity: Sponsor with originating lead:Converted contact
End Succeeded
Otherwise
End Cancelled
You may want to hide/remove the 'converted contact' lookup from the lead form and also hide the 'leads' from the navigation pane on the contact form just to tidy things up but that shoud do the trick.
Rob
Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011- Proposed as answer by Rob BoyersEditor Wednesday, August 10, 2011 9:35 PM
- Marked as answer by Donna EdwardsMVP Thursday, August 18, 2011 2:39 AM
Wednesday, August 10, 2011 8:41 PMAnswerer -
Hey Rob,
Thank you very much for your help!
I'm not sure how to re-activate the lead from the workflow. When I go to change the record status, that field is gone from the Update Lead form.
Have you created this workflow before?
Wednesday, August 10, 2011 9:13 PM -
Nevermind I found it. Sorry.Wednesday, August 10, 2011 9:16 PM
-
Remember, you must use the status change step to change the status, not the update step
Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011Wednesday, August 10, 2011 9:35 PMAnswerer -
Rob, it works great except for one caveat, when I open the Opportunity record I get an error saying "Out of stack space."
I can't understand why this occurs, this workflow shouldn't overflow the system. Do you know why this is occuring?
Wednesday, August 10, 2011 9:44 PM -
I think you have other issues there Michael, the workflow won't be the root cause, sounds more like an infrastructure issue.
Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011Thursday, August 11, 2011 11:21 AMAnswerer