Skip to main content

Notifications

Announcements

No record found.

Business Central forum

Temporary record (Type Error) suppressing insert of an Item.

(0) ShareShare
ReportReport
Posted on by 422

So I have a table with movies and i've created a button that creates a batch of Items from the selected movies. Now creating multiple movies in once works perfectly find. Also i'm able to check if a movie already exists and don't create it when it does. Now my problem is here:

I'm working with "Record 700 temporary". With this Record i list the errors if a movie already exists after the process of trying to create them. Now i've stumbled across the problem now that it will list the items in the errorlist that already exists but it won't create the non-existing item of a movie.

Following code is what i have at this moment:

begin
    TempErrorMessage.ClearLog();
    ConfigTemplateHeader.SetRange("Table ID", 27);
    CurrPage.SetSelectionFilter(Rec);
    if ConfigTemplateHeader.FindSet() then
        repeat
            OptionString := OptionString   ','   Format(ConfigTemplateHeader.Description);
        until ConfigTemplateHeader.Next() = 0;
    Selected := Dialog.StrMenu(OptionString, 2, SelectionLbl);
    Options := OptionString.Split(',');
    SelectedOptionName := Options.Get(Selected);
    if Rec.FindSet() then
        repeat
            Check := CodeU.InsertBatch(Title, SelectedOptionName, Rec);
            Clear(Item);
            Item.SetFilter(Description, Title);
            if Item.FindSet() and not Check then
                TempErrorMessage.LogIfEqualTo(Item, Item.FieldNo(Description), TempErrorMessage."Message Type"::Error, Title);
                // If i use the line above it won't create the item. 
                // If i just use a simple Message() instead just to check it does create the movie
        until Rec.Next() = 0;
    Clear(Rec);
    TempErrorMessage.ShowErrorMessages(true);
end;

Any help is welcome.

Categories:
  • CU29041152-0 Profile Picture
    CU29041152-0 2 on at
    Temporary record (Type Error) suppressing insert of an Item.
     

    It sounds like you've made good progress with your table of movies and the button that creates a batch of items from selected movies. Handling existing movies and avoiding duplication is a smart approach.

    Regarding the issue you're facing with the "Record 700 temporary," it seems like you're able to detect existing movies but are having trouble creating non-existing items. It's likely that the logic for handling existing movies and creating new ones needs to be adjusted.

    Without seeing your code, it's a bit challenging to provide a specific solution, but you might want to review the part of your code that checks for existing movies and consider how it interacts with the creation logic. Ensure that the creation logic is being triggered correctly for non-existing items and that any error handling mechanisms are appropriately configured. If you're still stuck, providing more details or code snippets could help the community offer more targeted advice.

  • Suggested answer
    InsertX Profile Picture
    InsertX 422 on at
    RE: Temporary record (Type Error) suppressing insert of an Item.

    Fixed it myself, Parameter true in ShowErrorMessages should be false.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans