Is it possible to write a complete record variable to an out stream?
This way doesn't work (from "Sales Header".OnModify):
...
"Job Queue Entry"."Parameter String" := STRSUBSTNO('DMS DOCTYPE %1', "Document Type");
"Job Queue Entry".XML.CREATEOUTSTREAM(outStream);
outStream.WRITE(xRec); //This statement fails.
outStream.WRITE(Rec);
"Job Queue Entry".Status := "Job Queue Entry".Status::Ready;
"Job Queue Entry".INSERT(TRUE);
Our NAS (running JOBQUEUE) has to perform a task when certain fields in the sales header change.
I'm trying to pass the complete xRec and Rec to the NAS Handler.
The NAS Handler will perform the evaluation of the changed fields and act upon it (asynchronous, on a different machine).
I'm not looking forward to writing all the separate fields one by one, and reading them back one by one in the NAS Handler.
Is there a way to convert a record variable to an XML structure in memory and write that into the BLOB field?
Comments
I think you will have to write the data field by field. You can use a Fieldref in a loop to cut down on your typing and to allow for table changes without having to change your code each time.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I tried using a Variant as an intermediate variable, but that doesn't work.
Is there documentation on what data types are supported in OutStream.Write()?
I'll use the FieldRef method, it seems the most reliable and flexible.
Those values are not yet saved in the database when the OnModify code executes, so I cannot GET() them.