Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Custom "Create Invoice" Functionality

Posted on by Microsoft Employee

I currently have some custom columns for line items in my order entity (salesorder/salesorderdetail) as you can see in the photo below.

Screen-Shot-2017_2D00_08_2D00_09-at-1.55.33-PM.png

However, whenever click the "Create Invoice" button, these columns are not brought over to the actual invoice, as seen below.

For example, the Vendor column is empty.

Screen-Shot-2017_2D00_08_2D00_09-at-1.55.49-PM.png

Is there any way I can make it so that these custom column values are brought over into the invoice as well? As far as I know, Invoice Products are not editable via workflows.

*This post is locked for comments

  • Suggested answer
    Brad.Klein Profile Picture
    Brad.Klein on at
    RE: Custom "Create Invoice" Functionality

    Not sure what version of CRM you are using, but CRM 2015 had relationships between quote product, sales order product, and invoice product they just couldn't be navigated to from the UI. You can use the mappings on these relationships to copy data between the entities just like any other relationship in CRM. See this article for details.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Custom "Create Invoice" Functionality

    Got it.

    First of all, you are not allowing to make any changes to out of the box script file (as the one mentioned above). Even if you were On-Prem, that would make your system unsupportable, and MS would not provide you support if any issue arises.

    Since you are using CRM Online, you don't really have that issue.

    The InvoiceDetail (Invoice Product) does not have any relationship with the SalesOrderDetail (Sales Product), but does have a relationship with the Product entity, so you might be able to get the Retail Price and Unit from there. Not sure regarding Vendor.

    You need to find a field that can match between these two records.

    If you can find that field, then you can create a plugin on your Create Message for the Invoice Detail that would retrieve those fields. The Invoice does has a record for the Sales Order, so maybe that is one way to find the related records.

    Not sure if there is another way.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Custom "Create Invoice" Functionality

    I have tried creating a workflow but I do not believe that workflows are supported for SalesOrderDetail and InvoiceDetail entities.

    I have identified the function that is called when the "Create Invoice" button is created, but I do not know where I can find this file. I believe that this is for an on-premise instance. Our system is online.

    /_static/sfa/salesorder/salesorder.js

    Without a way to find the salesorder.js file, I do not know how I would create my own function and have it execute it in a similar way as the old button.

    Any suggestions?

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Custom "Create Invoice" Functionality

    You might be able to create a workflow that on the create of a record, will retrieve the associated records from the SalesOrderDetail entity.  If that is not possible, you can override the logic of the existing Create Invoice with your own.

    Basically create a new Create Invoice button (Ribbon Workbench), hide the existing Create Invoice button and execute an Action on Click that will take the Sales Order/Sales Order Details and replicate them into Invoice.

    There might be another solution that I am unaware of as it related to Sales Order and Invoices, but I think these are your options.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans