0

I have a form with a grid of a tempTable. One of the columns in the grid displays the 'existsAlready' property:

FM_MovieTemp movie = ds.getFirst(1); 
while (movie)
{
    if (movie.existsAlready)
    {
        existingMovies = true;
    }
    info(movie.Title);
    movie = ds.getNext();
}
if (existingMovies)
{
    DialogButton Button;
    Button = Box::okCancel("Test",DialogButton::No);
    if (Button == DialogButton::Ok)
    {
        FM_MovieTemp movieBuffer = ds.getFirst(1);
        FM_MoviePersistLogic::PersistToDatabase(movieBuffer);
    }   
}

Called function:

public static boolean PersistToDatabase(FM_MovieTemp fM_MovieTemp)
{
}

The problem with this code is that, while the movieBuffer variable is filled with the data of the selected grid rowswhen it is created before the call to PersistToDatabase, it is empty in when received in the PersistToDatabase function. Could someone explain why this is and how I should correctly supply my selected grid rows to the other class?

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
Kai
  • 732
  • 1
  • 7
  • 23
  • Guessing from your previous question on a similar topic that it is Dynamics 365 Finance and Operations. https://stackoverflow.com/questions/73882596/using-inmemory-table-as-a-form-datasource-in-dynamics-365-fo – FH-Inway Oct 05 '22 at 20:01
  • @FH-Inway Yes, that's correct. Apologies for not mentioning the version – Kai Oct 06 '22 at 09:03
  • What are you trying to achieve with the above code? Can there be more than one temporary record? It seams you are only persisting the first record. Avoid using dialog buttons to save records, use a regular OK/Cancel with the persisting code in the `closeOk` method. – Jan B. Kjeldsen Oct 11 '22 at 20:43

0 Answers0