If user brings up a sales transaction, runs my tool to calculate freight and write freight, but doesn't change anything else, they can then navigate off of that sales transaction without the "do you want to save or delete the document" prompt and lose the changed freight value.
This is where I write the freight:
// Force the validation of the new freight amount
Dynamics.Forms.SopEntry.SopEntry.LocalOriginatingFreightAmount.RunValidate();
Dynamics.Forms.SopEntry.SopEntry.LocalOriginatingFreightAmount.ForceValidate(true);
Dynamics.Forms.SopEntry.SopEntry.LocalOriginatingFreightAmount.Value = WriteBackDoc.TotalFreight;
// Force the validation of the new freight amount
Dynamics.Forms.SopEntry.SopEntry.LocalOriginatingFreightAmount.RunValidate();
Dynamics.Forms.SopEntry.SopEntry.LocalOriginatingFreightAmount.ForceValidate(true);
Dynamics.Forms.SopEntry.SopEntry.CustomerPoNumber.Focus();
Dynamics.Forms.SopEntry.SopEntry.PullFocus();