Each action you create has an action ID, which is a long integer value that uniquely identifies the action. For each action you are defining, assign a unique integer value that identifies the action. Create constants for each action to make them easier to manage in your code.
Since multiple third-party products can add actions to Microsoft Dynamics GP lists, the ID of the product that defines the action must be encoded into the action ID. The BuildDictSpecificID() function is used to encode an action value and product ID into a single long integer action ID. You can use this function to determine the value you should assign to the constant you are creating for each action. This function takes a dictionary ID and the numeric value of the action, and returns an encoded value based on them.
For example, the following constant for the sample integrating application defines the action that opens the Contact History window.
ACTION_CONTACT_HISTORY: 1
The Expressions window available within Dexterity can be used to determine the encoded value for this action. Simply type the name and parameters for the BuildDictSpecificID() function and click Evaluate to see the encoded value. For example, the following illustration shows the encoded ID for the Contact History action.
Notice how the product ID (in this case 3333) is used for the function. An additional constant for the action is defined for the encoded value:
ACTION_CONTACT_HISTORY_ENCODED: 218431489
When a user chooses the action for a list, your code that processes the request will use the DisassembleDictSpecificID procedure to extract the product ID and the integer value assigned to the action. If it’s an action for your product, you will perform the appropriate actions. If it’s not an action for your product, your code should simply ignore it.
If you are defining actions for your own list windows, it is not necessary to encode the product ID into your action IDs. The product is already known. |