i needed to create a report that ran off one of the lookup guids on a form.
First I created a stored procedure that accepted a parameter that was the form guid, then I created the ssrs report and deployed it to a local server.
next, the tricky part, on the CRM form I created an iframe with a simple name and entered a bogus URL. Then on the Form properties page, accesible from the form edit ribbon I added this script as an on load event ... I set up the alerts only as checks when testing and removed them for the final publish
the only way I could get the guid value was to create an array, lookup the first value from that array and set it to a new variable (in the case new_id). This script also hides the iframe if there is no guid value
function Change_Report_Url()
{
var id = new Array();
id = Xrm.Page.getAttribute("guid_from_form").getValue();
if(id[0] != null)
{
var new_id = id[0].id;
alert(new_id);
}
var url = 'your_reportServer_reportUrl&id='+new_id;
alert(url);
var iFrame = 'IFRAME_with_bogus_URL_name';
if (id == null)
{
Xrm.Page.getControl(iFrame).setVisible(false);
}
else {
Xrm.Page.getControl(iFrame).setSrc(url);
}
}
New Radio Show!
4 years ago
No comments:
Post a Comment