I have a form that allows the user to click a btn and open another form...form2 is passed an input parameter (base don a field value in form1) and runs a sp via a webservice to refresh some secondary data...this happens during the OnLoad event...works fine
Problem is that when I aplied role based logic to the form (Open form2 in a ReadOnly view for certain users) it apparently bypasses the OnLoad code...and therefore my secondary data source never updates...the ReadOnly view is NOT the default view.
2 Roles : Reader (default) & Contributor
Rule on open is to switch to ReadOnly view if users are in Reader role
function XDocument::OnLoad(eventObj)
{
// Write your code here
// Get the Input value
var wVar = eventObj.XDocument.InputParameters["CourseID"].Value;
eventObj.XDocument.UI.Alert("CourseID = " + wVar);
// Get the DOM for the Seconday Data Source
var dat = XDocument.DataObjects("GetCourseInfo").DOM;
dat.setProperty("SelectionNamespaces", 'xmlns:sqlsoaptypes="http://schemas.microsoft.com/sqlserver/2004/SOAP/types" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes" xmlns:s0="http://tempuri.org" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:ns1="urn:schemas-microsoft-com:sql:SqlRowSet1" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-08-16T13:30:52"');
var xpath = "/dfs:myFields/dfs:queryFields/s0:GetCourseInfo/s0:CourseID";
XDocument.GetDOM("GetCourseInfo").selectSingleNode(xpath).text = wVar;
XDocument.DataObjects("GetCourseInfo").Query();
}