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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Display product attributes in a form

(1) ShareShare
ReportReport
Posted on by 4
Hi Experts, 

I have a requirement to add specifically 3 product attributes in numerous forms (Sales lines, Released products etc. ) next to item numbers. I don't want to add it like a display field as the users must be able to filter them in the forms. What is the best way to achieve it ? any help would be much appreciated. I found below code to get the attributes for an item. I am thinking to create a view for the same but just wanted to be sure that there is no other better way to get it done and the view should work. 
 
static void Demo_GetProductAttributes(Args _args)
{
    inventTable                 InventTable;
    EcoResProductAttributeValue ecoResProductAttributeValue;
    EcoResAttribute             ecoResAttribute;
    EcoResValue                 ecoResValue;

    while select InventTable where InventTable.itemid == "1604"
        join RecId from ecoResProductAttributeValue
        where ecoResProductAttributeValue.Product == InventTable.Product
            join Name from ecoResAttribute
            where ecoResProductAttributeValue.Attribute == ecoResAttribute.RecId
                join ecoResValue
                where ecoResValue.RecId == ecoResProductAttributeValue.Value
    {
        info(strFmt("%1 - %2 - %3", InventTable.ItemId, ecoResAttribute.Name, ecoResValue.value()));
    }
}
  • Martin Dráb Profile Picture
    240,866 Most Valuable Professional on at
    I think that creating a view is the best approach in your case.
  • André Arnaud de Calavon Profile Picture
    307,361 Super User 2026 Season 2 on at
    foHi,

    I concur with Martin. However, be aware of possible performance issues. You can check if there are already views available similar to what you need. 

    What is the exact purpose of these fields? Depending on the requirements, you can also consider creating physical fields.
     
  • Suggested answer
    Saif Ali Sabri Profile Picture
    2,829 Super User 2026 Season 2 on at
    ItemId Existence: Verify that an item with ItemId = "1604" exists OR  it might be due to missing relationships in the data.
  • Suggested answer
    Saif Ali Sabri Profile Picture
    2,829 Super User 2026 Season 2 on at

    1. Create a View

    Creating a view that combines the relevant tables is a good approach. This way, you can easily join InventTable, EcoResProductAttributeValue, EcoResAttribute, and EcoResValue to fetch the attributes you need. This will allow you to display them alongside item numbers in the grid and provide filtering capabilities.

    Steps to Create the View

    1. Create a View in AOT:

      • Navigate to the AOT, right-click on Views, and create a new view.
      • Add the required data sources (e.g., InventTable, EcoResProductAttributeValue, etc.) and set up the joins as per your requirement.
    2. Define the Fields:

      • Include the fields you want to display in the form, including the product attributes.
    3. Implement Filtering:

      • Make sure the view allows filtering on the fields you have included. This typically means ensuring the fields are indexed properly.

    2. Modify the Form

    Once you have your view created, you can modify the forms where you want to display these attributes:

    1. Add the View as a Data Source:

      • In the form's data sources, add your newly created view.
    2. Design the Layout:

      • Place the necessary fields in the layout next to the Item Number field.
    3. Filtering Logic:

      • Ensure the filtering mechanism works correctly. This can be achieved by setting the appropriate properties for the fields (e.g., AllowEdit, AllowFiltering).

     

    Using a view is typically the best practice for this requirement, as it centralizes the logic for retrieving product attributes and allows for easy filtering. Make sure to test the performance of the view, especially if you're working with a large dataset, and implement any necessary indexing for optimal performance.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 528 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 424 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 374

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans