Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Ask help with fields

(0) ShareShare
ReportReport
Posted on by 7

Hi guys, I started programming navision a week ago, but I ran into a problem that I can't solve. On the sales line, I want to put a field for the article in which the article table has the necessary content.
I have used the FlowFields Lookup function, but with that the field does not appear in the configuration packages. What could be an alternative? Alternatively, is this function the only one that can transfer field data from another table and load it in one by one?

Thanks in advance.

I hope I didn't ask stupid questions.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Ask help with fields

    Hi

    Not sure it will work, I am confused with your requirement.

    [EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnAfterValidateEvent', 'No.', true, true)]
        local procedure OnAfterValidateEvent_itemNo(var Rec: Record "Sales Line")
        var
            Item: Record Item;
            ItemUnitofMeasure: Record "Item Unit of Measure";
        begin
            if rec.Type = rec.Type::Item then
                if Item.get(rec."No.") then begin
                    rec.Newfield := Item.Desirecfieldvalue;
                    if ItemUnitofMeasure.Get(rec."No.", rec."Unit of Measure Code") then
                        rec.Quantity := ItemUnitofMeasure."Qty. per Unit of Measure";
                end;
        end;

  • Szaki33 Profile Picture
    Szaki33 7 on at
    RE: Ask help with fields

    I want it in sales line. But the real problem is, How can I specify 2 conditions for a request?

    Because I would need the Item Unit of Measure table to give me the value where the id and Code fields match the condition.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Ask help with fields

    Where you want this change?

  • Szaki33 Profile Picture
    Szaki33 7 on at
    RE: Ask help with fields

    i want this: WHERE("Item No." = FIELD("No."), Code = Field("Myfield what fill with data before with your code")));

    How can i do this with trigger?

    I hope, u know what i want.

    If not, write me what i should give.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Ask help with fields

    So what is the Sales Line field and item table field in that?

  • Szaki33 Profile Picture
    Szaki33 7 on at
    RE: Ask help with fields

    Yeah but the calc is not good for me, i want to change it like this:

    [EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnAfterValidateEvent', 'No.', true, true)]

       local procedure OnAfterValidateEvent_itemNo(var Rec: Record "Sales Line")

       var

           Item: Record Item;

       begin

           if rec.Type = rec.Type::Item then

               if Item.get(rec."No.") then

                   rec.Newfield := Item.Desirecfieldvalue;

       end;

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Ask help with fields

    There is already a where condition in your formula

  • Szaki33 Profile Picture
    Szaki33 7 on at
    RE: Ask help with fields

    Hello thanks a lot, its work fine for me, i wasnt to far from that. :)

    But now i have the next problem, how can i put "where". If I have 2 condition?

    I hope u know what i want.

    CalcFormula = lookup("Item Unit of Measure"."Qty. per Unit of Measure" WHERE("Item No." = FIELD("No."), Code = Field("Tour unit help")));

    It was my calc formula code.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Ask help with fields

    Hi,

    Flowfields never visibles on Config. package. In that case you need to change your logic. Create a new field on Sales Line Table, and OnAfterValidate event of sales line with No. field pass the values from the Articale table to your new table. and then you can use your config. package.

        [EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnAfterValidateEvent', 'No.', true, true)]
        local procedure OnAfterValidateEvent_itemNo(var Rec: Record "Sales Line")
        var
            Item: Record Item;
        begin
            if rec.Type = rec.Type::Item then
                if Item.get(rec."No.") then
                    rec.Newfield := Item.Desirecfieldvalue;
        end;

  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: Ask help with fields

    Hi,

    If I understand you correctly, you can do this by simply adding a table relation to your sales line field, like this

    tableextension 50100 MyExtension extends "Sales Line"
    {
        fields
        {
            field(70000; YourField; Code)
            {
                TableRelation = Item."No.";
            }
        }
    }
     

    This should establish the relation, lookup, and allow data transfer.
    Regards

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans