Salesforce

How Do I Set or Get a Property of a COM Object? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Set or Get a Property of a COM Object? (Magic xpa 4.x)

Once your COM object is declared, you can change its properties by using Set Property, or fetch properties by using Get Property.

Get and Set Property are used to change and retrieve the value of an object. For instance, in the Calendar object, Set Property is used to set the default date, and Get Property is used to retrieve the date the user selected.

Using Get and Set Property with a COM Object

  1. Open up a line in the appropriate logic unit.

  2. Set the operation to invoke by typing I or selecting from the drop-down list.

  3. Set the invoke type to COM by typing C or selecting from the drop-down list. Tab.

  4. Zoom to bring up the COM Object dialog box.

  5. Zoom from the Object field to select your COM object.

  6. Select Get or Set Property from the drop-down list on the Option field.

  7. Zoom from the Method field to select the method you want to invoke.

  8. Press Escape to close the COM Object dialog box. Tab to the Arguments field, and zoom.

  1. Now you will be presented with a list of arguments for this Get or Set. Note that you get a lot of information about these arguments in the list, such as whether it is an input or output parameter, whether it is optional or not, and the data type.

    If you click on the box in the
    Create column, Magic xpa will create a variable that matches the argument data type. However, Magic xpa also does a lot of the data conversion for you, so you don’t have to be as exact about the data types as you would if you were using other programming tools. For instance, this example uses the VT_I4 type, which, if you study COM objects, means you need to pass in “signed long integer”. But we just pass it an expression (which happens to be the number one in this case) and Magic xpa does the rest of the work.

Now you have created a call to Get or Set a property in your COM object.

Hint: To save time, you can copy Invoke COM operations to start the next one. This is particularly useful if you are invoking the same method over and over, as will happen when, for instance, you are formatting a Word document using COM objects and need to add paragraph breaks. Use Ctrl+Shift+R to copy an existing operation, or Ctrl+C Copy and Ctrl+V Paste.

Reference
Attachment 
Attachment