Skip to main content

I’ve been puzzling through this issue and I’m not sure where to go for figuring this out.

Action button on Sales Order Maint will

  1. Create a record in a custom table.
  2. Load up the graph for that custom table and press an action button.
  • Custom graph passes it’s record into a method to be updated.
  • Custom graph passes it’s record into a second method to be updated. But it loses changes coming out of the second method. It’s almost like the record is passed into the second method as a copy instead of a reference to the record.

If, however, I open up the graph for the custom table and click on the action button - the above process works just fine.  My Order Entry customization is literally pressing the action button on the custom graph.

I’m using this form for updating the field values to try and ensure that the correct cache is being updated.

myCustomGraph.Cachesmtypeof(MyDAC)].SetValueExt<MyDAC.myField>(myRecord, SomeValue);

and

myRecord = myCustomGraph.Cachesmtypeof(MyDAC)].Update(myRecord);

 

So I think I’m curious on what I might look out for to figure out why myRecord is losing/forgetting changes when being run from the Order Entry button but retains it when running the process from the Custom Graph button.

Hi @ddunn  Is it possible to share the code?


I have seen this happen with SQL Autonumber keys on the child table. During the insert process but before the cache is persisted the ID field is a large negative number, if you pass that record into another graph it doesn’t have the same understanding of what the negative number means and so it basically drops the changes as there is no record in the DB with that index. when you run it locally it works as the graph understands you are inserting so it saves normally.

I would, if you can, persist before calling the second graph so you have a proper ID, assuming I am correct :)


I’ll add some code shortly. I just want to make sure that you’re not having to wade through too much.

Fortunately this doesn’t have any child records - I’m just passing an existing record through a handful of methods to have some fields updated and then save it. This has to be some sort of scoping issue but I also know that the cache can work in mysterious ways (but shouldn’t).

I’ll report back soon.


This appears to have resolved itself.  I’ll file this under ‘evil spirits’.


Reply