This is a common request, and the following process applies to bringing any field from one entity to a different entity’s screen.
It all ties back to creating and managing entity relationships.
In Settings > Customizations > Customize the System, or in your custom created solution, navigate to Components > Entities.
Find the Invoice entity, and go to N:1 Relationships.
Find the existing order_invoices relationship. Note that the behavior is Referential, Restrict Delete.
If a relationship is not defined on your custom entity, create a new relationship as needed.
Open the relationship, and on the Mappings add a new mapping.
In the Source Entity, in this case the Order, select the ordernumber field. In the Target Entity select the field you want this information displayed in. In my case I created a new field named new_orderid, same Type (Size) as the ordernumber in Order. The restriction here is that the target field must be of the same type, and same or larger size to accommodate all data from the source field.
Click OK, then Save and Close the Relationship.
One other thing I like to do in such a case, is to make sure no user changes the Order ID. In the new_orderid properties, I make the field read-only.
Now save and publish all customizations. When creating new invoices for orders, you will see on your invoice screen the order id from your related order.
Enjoy!
Leave a Reply