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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to add product to specified opportunity using C#?

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a request to interface opportunity in CRM with web application on adding product lines.

Is there any way to add product to opportunity using c#? What are the steps?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: How to add product to specified opportunity using C#?

    You will have to create opportunity product entity records and attach the opportunity with the record.

  • Community Member Profile Picture
    on at
    RE: How to add product to specified opportunity using C#?

    Thanks mate, just figure out the code

  • Verified answer
    Emre GULCAN Profile Picture
    2,379 on at
    RE: How to add product to specified opportunity using C#?

    Hi MarkoA,

    This is "OpportunityProduct", you should take a look at SDK 

    If you want do this quickly, you can simply use XrmLibrary, and run codes below;

    OpportunityProductHelper helper = new OpportunityProductHelper(_organizationService);
    //Add existing product 
    helper.Add(Guid.Parse("opportunity record id"), Guid.Parse("product record id"), Guid.Parse("uom id"), 1);
    
    //Add manual product
    helper.Add(Guid.Parse("opportunity record id"), "Manual added product name", 1, 5);


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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans