Add Field to PO

I am trying to add a field from the items table to my Purchase order report named ‘Common Item’. Can someone help me with the steps to complete this in the report. Currently i have Purchase header, Purchase Line, Purch. Comment line as my ‘data items’…

I added the item table as a data item , and created a global CommonItemNo with the data type text… Iam a little confused what to do next

I guess specifically where is the OnAfterGetRecord() trigger

Ah ok i define the OnAfterGetRecord() trigger by selecting the data item and then clicking c/al code…

I added


CommonItemNo.GET(Item.“Common Item No.”)

and changed the C/AL Global 'CommonItemNo to a record dataType with a subtype of item… and in the C/AL symbol menu selected CommonItemNo, FieldName, and Common Item No.

in the text box the source expression is Item.“Common Item No.” and the DataSetFieldName is CommonItemNo

ok with that all said i do not see the common item number showing up on the repot… How can i track down where the problem might be?

Add Common item as a flow field to the purchase line table, that will be much easier.

  1. In which dataitems OnAfterget Record trigger?

  2. where did you add the text box in sections?

David how can I add Common Item No from the Item table into the purchase line table? I read this but that is a flow field from the same table… Also do i need a developer license for that?


I added the textbox in the Purchase Line, Body section of the report… Should I add the CommonItemNo.GET(Item.“Common Item No.”) in the Purchase line - C/AL Editor? When i do this and save the error is " The variable is not a record. ‘Variable.Field’ is invalid

Keep going downt he help to

that explains in pretty good detaiul, but in your case…

Create this in Table 39,

  1. Shift+F12

  2. TABLE

  3. Find Table 39


  5. Use a field number that wont clash between 60,000 and 89,999 eg 82,100

  6. Method is LOOKUP

  7. Table is Item

  8. Field is CommonItem

  9. Table filter is No. = No.

The rest you should be able to work out.

Did you try by writing Item.GET(“No.”); in Purchase Line OnAfterGetRecord Trigger and Add Item.“Common Item No.” in SourceExpr of text box…

Please NO!

If you are going to go this route, then the code is

IF (Type <> Type::Item) or NOT Item.GET(“No.”) then


Other wise the report will simply error out on the first non item line and nothing will print.

True…I am just checking whether this points to the result what he is expecting or not…

David, I do not have access to this table 39… Purchase Line… to add a flow field, I presume it is due to the licensing restriction… I have a customer license… what do i need to add flow fields to my license?

Rock and Roll!!! [Y]

Contact your Partner he will do it for you…

Mohana—YES YES that is exactly what i was expecting… (when a common item No is NOT found it does error out)

crap i am running in to the error when there is no field (common item number) found but i attempted the code from

IF (Type <> Type::Item) or NOT Item.GET(“No.”) then


no go… it only works with values that DO return Common Item numbers

Is it showing correct vaues in report?

If Common Item no. is not there for Item then you need to show error message?

I think I just might give up altogether…

Sean, you need to get your partner in and have them add the flowfield. Programming this type of thing on forms is about the worst thing you can do, and I am getting increasingly irritated with one of the MVP’s helping people do this kind of crap. Yes it works, but now you will need to program the same thing on every form that uses that table.

At the very least you need to take a class in NAV development, and get a proper education on programming and syntax. This freewheeling is not helping you.

Denster, I really admire all of you…

But please mind your words while posting regarding me…

I never interfere in any of users answers…we are here to help questioners…not to correct answers…

Depends upon their exp and knowledge they give suggestions…

if user is interested then he will take the suggestion…thats it…

I am not here to impress any of you with my behaviour and answers…

If you people really have any suggestions or obligations then you are always welcome to contact me via PM but dont make it public…

Wow … just WOW! Sorry for offending you ! This forum is getting increasingly frustrating. Den would you like to pay for me to go to a NAV class? I cant believe the odasity !

When i ask how to do something Den’s response is ALWAYS get your partner! What is up with this forum and their response being get your partner ! I simply do not understand you Den… it is no sweat of your chin for someone else to help me with this problem. Isnt this how we all have learned… doing, asking questions, not understanding getting more help. What difference is it to YOU for someone else to help me? If the blanket response is get your nav partner why is this forum here!!

how embarrassing !