Wednesday, June 20, 2007

Creating a button to call any Actions Menu function

I found a way to call the "Apply Rule" window and pass all the necessary parameters from a button on the form. This procedure can be used though to call any Actions Menu fuction on a form. Below is example code that creates a button on a custom entity. Place this code in the isv.config.xml file. The key piece of code is the JavaScript parameter value: onActionMenuClick('applyrule', 10023)

The only thing you have to change is the ObjectId (10023 in the sample code below).


<Entity name="new_snapshot">
<ToolBar ValidForCreate="0" ValidForUpdate="1">
<Button Title="Run Process" ToolTip="Run Data Process" Icon="/_imgs/ico_18_4405.gif" Url="" JavaScript="onActionMenuClick('applyrule', 10023)" PassParams="0" WinParams="" AvailableOffline="false" WinMode="1"/>
</ToolBar>
</Entity>


To call any other Actions Menu function, open up the form you want to the button on, view the html source of the form and search for the the Actions Menu fuction (e.g. Deactivate). Copy the JavaScript function into the JavaScript tag on a button.

No comments: