I have an infopath form that was developed in Infopath 2003 and later upgraded to Infopath 2007. This form is saved to a Sharepoint 2007 library when submitted. This form uses the old JScript and calls out to windows shell to get logged user. I put the user id in a hidden text and compare it to values based in the Sharepoint list. If the userid is contained in the values returned from Sharepoint I use conditional formatting to hide an attachment control. This form runs full trust and is digitally signed. The form works great when you fill out a new form and hides attachment control but if you open to read or edit an existing form its doesn't work. Does anyone have any ideas on what to look for ?
This is code on page load:
function XDocument::OnLoad(eventObj)
{
//Load the form path: address to the library
var wshShell = new ActiveXObject("Wscript.Shell");
var wshEnv = wshShell.Environment("Process");
var username = wshEnv.Item("UserName");
var strEmployee = XDocument.DOM.selectSingleNode("my:myFields/my:loginid");
strEmployee.text = username;
}
Here's function that fire to determine user security :
contains(@ViewAttachments, loginid)
Then I say if username=false hide the attachment control.
Thanks in advance.