Synchronous vs. Asynchronous

Synchronous (bad practice and will not work on mobile)

var userRecords = g_form.getReference ('caller_id');
alert("User ID: " + userRecord.user_name + "\nLocked out:" + userRecord. locked_out);

Also synchronous (bad practice and will not work on mobile)

var callerEmail= g_form.getReference ('caller_id.email');
alert(" Caller email _ " + callerEmail";

Asynchronous (Considered best practice! Do this!)

var userRecord _ g_form.getReference('caller_id', callerInfo);

Function callerInfo (userRecord) {
    alert("User ID: " + userRecord.user_name + "\nLocked Out:")
        + userRecord.locked_out);
}

Synchronous getReference() method calls lock the form until the requested record is returned from the database. Asynchronous execution allows users to continue using the form while the method call executes.

The first example executes synchronously resulting in a poor user experience. getReference() without a callback function will not run on the Mobile platform.

The second example also executes synchronously and returns only one field's value. The performance penalty is the same as for the first example.

The third example demonstrates how to make an asynchronous call to the server.

results matching ""

    No results matching ""