0
votes

I am generating a production order and inserting material lines. When creating them, I have to set some extension fields. To get to those fields, I need to perform a graph.view.Insert(row) action. After, I can access the extended fields. After setting all of the extended fields, I need to perform a graph.view.Update(row) so that those values are set in the cache. After I am done, I perform a graph.Actions.PressSave(). When I execute this and navigate to the details record, I see two lines for each detail instead of just one. I've noticed this happening on any grid I insert a record into, set values, and then perform an update before saving. Is there any reason for this?

Here is some example code of what I'm doing:

                    AMProdMatl newMat = new AMProdMatl();
                    //Set values
                    graph.ProdMatlRecords.Insert(newMat);
                    AMProdMatlExt newMatExt = newMat.GetExtension<AMProdMatlExt>();
                    //Set extended values
                    graph.ProdMatlRecords.Update(newMat);
                    graph.Actions.PressSave();

The result:

enter image description here

I want to emphasize again that I've run into this issue in other sections of Acumatica and I don't think this is a Production module exclusive issue.

1

1 Answers

1
votes

Make sure you are using the return of the insert and update statements before reusing the row in additional statements.

For Example:

newMat = graph.ProdMatlRecords.Insert(newMat);