Salesforce

How Do I Simply Execute .NET Code? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Simply Execute .NET Code? (Magic xpa 3.x)

Magic xpa executes .NET code in the background whenever you use .NET objects. However, you can also execute .NET code directly, giving you more complete control.

  1. First, create the necessary variables. In this example, there are three: vValue1, vValue2, and vSum. All are Magic xpa Numeric variables.

  2. Create a handler where the code will execute. In this example, the event handler executes when the Calculate button is pressed. The event uses Force Exit = Editing, so the field value is stored before the button is pressed.

  3. Within the handler, create an Invoke .NET operation. Zoom from the field after .NET.

  4. Here you will get an ExecuteDotNetCode window. Fill in the Method Name field with whatever name you want to use.

  5. Zoom from the Arguments field. This will open up an Arguments window. Create one line for each of the two input arguments:

    1. Press F4 to open up a line.

    2. Zoom from the Var field to select the variable (or use an expression from the Exp field).

    3. Magic xpa will suggest a .NET type. Accept it or change it to something else.

    4. Give the variable a .NET name. Here, NumA and NumB were used.

  1. Zoom from the Return Value field, to select the variable that will hold the result. Again the Return Value Type is suggested: you may accept it, or change it.

  2. Now, in the .NET Code area, type in your code. In our example,

    return NumA + NumB;

    was added. Magic xpa will automatically pass NumA and NumB, based on the arguments, and will automatically store the results in the Return Value variable, C.

This is a simple example of .NET code; however, you can use more complex code to do whatever is needed.

See also

The Online and Rich Client Samples projects (program NE06 and RNE06)

Reference
Attachment 
Attachment