Salesforce

The Init Property (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

The Init Property (Magic xpa 3.x)

In some cases, the Init property of a variable is evaluated on the server, for example for a column in Create mode, and in other cases is evaluated on the client, such as a local variable.

Since it is not possible to know when the property will be evaluated, the functions used within the expressions need to be neutral functions, meaning neither server-side nor client-side. But often, there is a necessity to use a function belonging to one of the groups. Client-side expressions cannot be used in the Init property. However, if you need to use a client-side expression in an Init property, do the following:

  1. Define a new variable that will hold the function's value.

  2. Within the Record Prefix, update the variable with the relevant expression.

  3. Remember that if you are dealing with a field from a table, the initialization is only valid when the task is in Create mode. Therefore, you need to condition the Update operation with Stat (0,'C'Mode).

Note:

It is allowed, but not recommended to use a server-side expression in the Init property because it will cause an access to the server whenever the init should be performed (for example: init on a real field when the task is in Create mode).

In this example, there are three fields with Inits.

  • The first one uses a Neutral expression, which has no marking to the left. This one is OK.

  • The second Init uses the Menu() function, which creates a client-side expression. This will generate a syntax error message.

  • The third Init uses CallProg(), which makes a server-side expression. This will also generate a syntax error message.

If you need to use client-side or server-side expressions in an Init, use an Update Variable operation instead.

  • For Server-side expressions, it is recommended to do the update in Task Prefix in order to avoid extra access to the server.

  • For Client-side expressions, do the update in Record Prefix.

If your Init is for a newly-created record, you should do the update in Record Prefix, using Stat(0,'C'MODE) in the Condition property.

Reference
Attachment 
Attachment