Salesforce

How Do I Execute Task Prefix/Suffix Logic of a Subform only on Opening the Subform Task for the (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Execute Task Prefix/Suffix Logic of a Subform Only on Opening the Subform Task for the First Time by its Parent? (Magic xpa 4.x)

Task prefix executes whenever a task starts, and task suffix executes whenever the task ends. When you are using a subform, the subform task executes once, to display its contents, when the parent task first executes. But it also executes when the parent task is refreshed, and then again when the user actually enters the subtasks. So, if you want to have logic that executes only during this initial execution of the subform task, you need to use the SubformExecMode() function.

If the subform task is opened for the first time, SubformExecMode(0) will return 1. So using

SubformExecMode(0) = 1

as the condition on the block will cause the block to only execute when the subform is called for the first time.

Coding a block that only executes when the subform executes for the first time

  1. Open up a line in the logic unit you are modifying (F4 or Edit->Create Line).

  2. Select the Block operation by typing B or by using the pulldown list.

  3. Two lines will open up, a Block If and a Block End. Tab to or click on the field after the If.

  4. Zoom (F5, double click) to the expression rules. Enter the expression:

SubformExecMode(0)=1

  1. Press Enter to select the expression and bring back the expression number.

Now the block will only execute when the subform is executed for the first time.

See also

The Online and Rich Client Samples projects (program SB07 and RSB07)

Reference
Attachment 
Attachment