web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Create an opportunity automatically from lead and close opportunity

(1) ShareShare
ReportReport
Posted on by 190

Hello,

I want to create a workflow that when a lead has a specific lead source, it will automatically qualify the lead and create an opportunity.

Then, when the opportunity is created and contains a specific referral source, it will automatically close as won.

From my understanding, you would need two separate workflows for each specific action. Lets say the lead source I want to use is called Web Lead. I tried creating a workflow called "When lead source equals Web Lead ----> perform action QualifyLead.

However, this is causing an error. It says I need to give a specific lead ID - but this will be using the same lead ID every time then which makes no sense.

On the opportunity level - I tried the same workflow with referral source instead of lead source - and then CloseOpportunity as Won. This time, it won't work because it wants me to insert a specific close date, when I want it to just be the date it is actually closing on.

Any help would be greatly appreciated. Thank you.

I have the same question (0)
  • Suggested answer
    Marco.P Profile Picture
    2,405 on at

    Hi,

    for the close date you can use the Process execution time:

     crmbusiness.wordpress.com/.../

    For the lead part, could you post some screenshot of your workflow ?

  • Verified answer
    Paul_Owen Profile Picture
    2,027 on at

    Hi the Lead ID is the Lead the workflow is running on, to set the date you can use the workflow execution time as already suggested

    pastedimage1585218816750v1.png

    Regards

    Paul

  • dynamicsgs Profile Picture
    190 on at

    Hi,

    I will show you what I have done thus far. It just doesn't seem to be working. Can you see anywhere I've gone wrong?

    3426.MicrosoftTeams_2D00_image.png

    Regards,

    Darragh.

  • dynamicsgs Profile Picture
    190 on at

    5383.MicrosoftTeams_2D00_image-_2800_1_2900_.png

  • Verified answer
    Paul_Owen Profile Picture
    2,027 on at

    Looks correct to me assuming it meets the condition, does it work if you run it on demand?

    Regards

    Paul

  • dynamicsgs Profile Picture
    190 on at

    Hi Paul,

    What do you mean by on demand?

  • Verified answer
    Paul_Owen Profile Picture
    2,027 on at

    You've ticked the box to Run as an on demand workflow so you can select a record/s and select Run Workflow from the ribbon, then check the process runs succesfully by having it open and selecting the Process Sessions Tab.

    pastedimage1585306157079v1.png

    Regards

    Paul

  • dynamicsgs Profile Picture
    190 on at

    Hi Paul,

    I have switched this now but when I try create the lead with that specific lead source it is now giving me an error. When I changed it back to background process I was able to create the lead but it wasn't firing the workflow (qualifying the lead).

    Here is the code of the error:

    Business Process Error
    1 is not a valid status code for state code LeadState.Qualified on lead with Id a8aa8f03-1870-ea11-a811-000d3a20fd55. If you contact support, please provide the technical details.
    Activity ID: 5e3b78ae-a6ff-4746-ad26-1402fb42fbd8
    Timestamp: Fri Mar 27 2020 10:45:06 GMT+0000 (Greenwich Mean Time)

    MicrosoftTeams_2D00_image-_2800_2_2900_.png

  • dynamicsgs Profile Picture
    190 on at

    This is what is appearing under the Process Sessions 

    8546.MicrosoftTeams_2D00_image-_2800_3_2900_.png

  • Verified answer
    Paul_Owen Profile Picture
    2,027 on at

    Open the one in waiting, what error is it showing? Statecode 1 is inactive because you have it as a real time workflow now your trying to create an inactive record I think which you can't do. I just recreated this in my test environment and it works.

    pastedimage1585309259041v1.png

    pastedimage1585309285817v2.png

    Regards

    Paul

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 184 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 125

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans