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 :
Small and medium business | Business Central, N...
Answered

How to update value on subform field based on Item card no in business central

(1) ShareShare
ReportReport
Posted on by 251
Hi Guys,
 
I want to do the customization :
On Item card ,we have one subform .i.e. Sales Price subform. And on the subform there is one field.i.e. Product No.
So when I add new line on that subform,that product no. should be auto populated based on Item No.
 for example,
If Item no is : 100001 ,then on that subform ,the product no. should be automatically populated as 100001.
Is any way to do this.
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    93,135 Super User 2025 Season 2 on at
    How to update value on subform field based on Item card no in business central
    Hi, This seems to be a very basic requirement. You can add this logic in the OnValidate trigger of Item no. Here is a similar reference, I hope it can give you some tips.
     
    Thanks.
    ZHU
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,182 Super User 2025 Season 2 on at
    How to update value on subform field based on Item card no in business central
    To achieve the automatic population of the Product No. field on the Sales Price subform based on the Item No. on the Item Card, you can customize the subform by adding a piece of code in the OnInsert trigger or in the OnValidate trigger of the Product No. field.
  • Test user Profile Picture
    251 on at
    How to update value on subform field based on Item card no in business central
    I also think that way.But how can we defined the code on Onvalidate trigger on product no. on the subform.because Onvalidate trigger runs when we enter or select the product no,then on that onvalidate trigger execute.
    I want this : I have just select the Price list code on that subform,then product no. should be populated as current Item No.
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,182 Super User 2025 Season 2 on at
    How to update value on subform field based on Item card no in business central
    Hi, try implementing it in the OnInsert trigger of the table. When one field is inserted, the other field, where you place the logic, will automatically get populated.
     
  • Test user Profile Picture
    251 on at
    How to update value on subform field based on Item card no in business central
     
    Hi, try implementing it in the OnInsert trigger of the table. When one field is inserted, the other field, where you place the logic, will automatically get populated.
     
    On which table : Item or Price list table-Oninsert trigger?Can you show me the example

  • Verified answer
    Khushbu Rajvi. Profile Picture
    19,182 Super User 2025 Season 2 on at
    How to update value on subform field based on Item card no in business central
    Hi, Try using the code below and apply it to the Sales Price table. The Rec.No refers to the primary key of the table, and it's utilized in the property SubPageLink to define the relationship to the Item in the Item table. For example, I have used: SubPageLink = No = FIELD("No."); to link the subform to the item
     
     
    trigger OnInsert()
        var
            ItemRec: Record Item;
        begin
            IF ItemRec.Get(rec.No) THEN Begin
                Rec."Product number" := ItemRec."No.";
            end;
        end;
     
     
    When you add value in price list code and enter product number will automatically populate with the item no.
     
    Hope this helps
  • Test user Profile Picture
    251 on at
    How to update value on subform field based on Item card no in business central
    Hi ,Khushbu Rajvi.  Thanks for your valuable time.
    I just set one property on subform page PopulateAllfields =true,then its worked, for my case no need to write any other code.just simply i have added this property on page, and its work.






  • Test user Profile Picture
    251 on at
    How to update value on subform field based on Item card no in business central
    Hi ,Khushbu Rajvi.  Thanks for your valuable time.
    I just set one property on subform page PopulateAllfields =true,then its worked, for my case no need to write any other code.just simply i have added this property on page, and its work.
     

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 > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,761

#2
Sumit Singh Profile Picture

Sumit Singh 2,611

#3
YUN ZHU Profile Picture

YUN ZHU 1,975 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans