Tuesday, June 26, 2007

Dynamically Changing an IFrame URL

Here is the code to dynamically change an IFrame URL. Put this code in your onLoad event handler on a form:

var ProcessID = crmForm.all.new_fieldname.DataValue;
IFRAME_report.location='http://www.google.com';


You can also hide an IFrame onLoad and display it when needed by including the following code:

crmForm.all.IFRAME_report.style.display = 'none';

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.