Salesforce

How Do I Force Writing the Current Record to the Database? (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Force Writing the Current Record to the Database? (Magic xpa 2.x)

Usually, in an Online or interactive Rich Client task, Magic xpa writes the current record when the user leaves that record --- by moving to the next record or exiting the task. However, there are times that you will want to save the record before the user leaves the task. A common scenario is when you want to add a “print” button to the screen, to print the current record. If the print routine includes the current record, then you need to be sure that the current record is committed before the routine runs.

This is easily done by using the Record Flush Internal event.

Here we have a Print Order handler, which invokes the Record Flush Internal event before calling a program to print the order. This ensures that the record is written before the Print Order is called.

Note that the Record Flush event is an internal event and therefore it is a synchronic event that is raised with Wait=No. In order for the print program to be executed after this event, it must be called from a separate handler that is also raised using Wait=No.

When using Record Flush, you need to make sure that the task is in an idle state: that is, when the task is not interacting with the user.

Hint: Instead of explicitly calling Record Flush, you can also use a User Event with a Force Exit of “Post Record Update”. This forces the current record to be written before the event is executed.

See also

The Online and Rich Client Samples projects (program SQ05 and RSQ05)

Reference
Attachment 
Attachment