How to reference a UD Field from another Table

We have created a custom ud field for the Part table and added the corresponding check box in app studio. It is saving and working fine. We now would like to reference that field when we add that part as a line item. When you add a line and give it a part number it brings the description over along with other properties from the Part table. We would like to include the custom field we have added to the OrderDtl table also. After some research we tried using Extended Properties Maintenance. We added a custom ud field to the OrderDtl table that matched the one in the Part table. We then went to Extended Properties Maintenance to the OrderDtl_UD table and added the matching Part field. The default OrderDtl has extending properties and I assume that is how OrderDtl references PartNum , LineDesc etc from the Part Table? After all of that we ran a BAQ with OrderHed, OrderDtl and Part displaying the custom ud fields. The custom ud fields from OrderDtl do not match the Extended fields from the Part table. I included a screen shot from the default OrderDtl extended property and the one we created. One difference is the default OrderDtl extended property has Part and PartNum in the Default Properties section but they are grayed out. The one we created does not have Part_UD or the ud field. Any ideas?

default OrderDtl → PartNum Extended fields

our OrderDtl _UD → CUSTOM_UD_FIELD Extended fields

I use a post processing bpm on SalesOrder.ChangePartNumMaster to get the Part data.

@gpayne Thanks for responding. The reason for adding the ud field was to be able to disable or hide a button based upon whether the field was true or false. The button is located on the Lines card inside sales order entry. So depending on which row is active I need to read the data view of OrderDtl.CUSTOM_FIELD for that item and either enable or disable the button. In the screen shot the bottom 2 lines have a (boolean) field that is true and the top 2 are false in the Part table. They are all false in the OrderDtl table. I am trying to disable the button for the top 2 and enable it for the bottom 2.

First do the bpm to copy the Part.Configurable_c to OrderDtl.Configurable_c and make sure the data shows.

Then in app studio make a data rule to enable/disable the button based on that value. Pg 206 of the app studio guide.

@gpayne We are trying to do a Method Directive to copy the Part.Configurable_c to OrderDtl.Configurable_c. We have only done a couple of bpm courses. We have isolated the method that runs after you enter the Part on a new line item and press enter or tab. It is the SalesOrder.ChangePartNumMaster. We have it displaying a message when we do this. We are kinda lost at this point. Not sure how to access the Part table or ,once we do, update OrderDtl table. We found the “Epicor Kinetic BPM Cookbook” but do not see an example that does this. We have experience with c#. Any pointers?

@James_Morris This is easy with a widget, but I also did a c example.

Update Table by Query will do this since partNum is already a parameter.


Query

Fields

Binding

code Not tested. You could also use the parameter partNum

foreach (var ttOrderDtlRow in (from ttOrderDtl_Row in ds.OrderDtl
                                     where ttOrderDtl_Row.Company == Session.CompanyID
                                     select ttOrderDtl_Row))
{
   
    var sc01 = Db.Part.Where(w => w.PartNum == ttOrderDtlRow.PartNum).Select(s => s.ShortChar01).FirstOrDefault();
    
    if (sc01 != null)
    {
        ttOrderDtlRow.SetUDField("ShortChar01",sc01);
    }
            
            
}
1 Like

@gpayne The widget worked. I have not tried the c# but it looks like it would work.

1 Like

Thanks, what a coincidence I happened to need this exact thing!