.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Getting User_Name when opening a form

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :SharePoint

Hi Everyone:

Scenario on  MOSS with Infopath Form Services:

  1. Two libraries - Library 1 is a list and Library 2 is Infopath form library (browser base form)
  2. A workflow in Library 1 creates a item in Library 2 and pre-populates the form with some data from the list (this works perfectly)
  3. Also a  user can create a form directly in Library 2 (the form library)using the New button
  4. The form has a hidden field which captures UserName() and if User Name = another field in the form, the User can make a change, if it doens't match User can't change the data)


  1. When a user creates a new form in the library, the hidden field is correcty filled in with the logged on User.
  2. If they save, close and open the form, the field still shows logged in user
  3. BUT, if the form is created and saved in the form library by the workflow, and a user then opens the form from Library 2, the Username() blank.
  4. So, one a form is created by the worklflow and a user opens it after the fact, how do I capture the Logged in user who is opening it for the first or subsequent times?

Thanks for your help!


View Complete Post

More Related Resource Links

Error when opening Infopath Form


Background: Created an Infopath 2003 form with 2 views (1 as Read-Only View and another 1 for Submitting content) and published to a Sharepoint 2007 Library.

Working: When a user opens a new form it opens in submit view; once the form has been submitted, when the user tries to open again, the form opens in read-only view.

Error: 99% of the users do not face any issues, however when the the rest 1% of the users try to open a new form; they receive the following error and are unable to open the form.

Form template: _http://server/sites/subsite/library/forms/template.xsn
InfoPath cannot open the following view: Edit_View
The following view file is not valid: view1.xsl
The file is not a valid XML document.

An invalid character was found in text content.

Line 673, Position 12

I am not sure what is wrong here (or) from where this error is being generated!

Balaji Baskar [Please mark the post as answer if it answers your question]

Switch views when opening a form depending on submit locations?



I would like to know it was possible to switch views when opening a form depending on where the form has been submitted.

I am submitting my form to library A and library B and want to be able to open it in view 1 in library A and in view 2 in library B.

Is there a way to set some url conditions in the open behavior rules?

Thanks a lot!

Error opening an Infopath form

I am trying to open an Infopath xsn form and I get the following error - "infopath cannot load this form. Either the signature is corrupted, or the certificate used to sign this form is expired or revoked. Contact the author of the form." I am the author of the form. I tried calling my cellphone number but there was not answer. Anyway, I've encountered this error before and I ended up redoing the form from scratch. I don't want to do that obviously. Is there a way to open the form somehow?Thanks,Dave

database schema for online account opening form

what should be the database schema for online account opening form with joint account holders and every participants (in a joint account) have seperate contact and personal detials.Please suggest.

opening a web browser without opening form on windows form load event

Hello All, I have a main frame which has a display button. after clicking on display button I usually open a windows forms. Now I have a requirement to open a web page after clicking on display button. I should not show windows form to the user. for that I had written following code in the Form_int (override) event of windows form. System.Diagnostics.Process.Start(http://www.google.com); and I commented out ShowDisplay(); code.  Everything looks good till now and when I run the project and clicked on display button web browser has been opened, but if I click again another web browser is being opening. but I don't want another browser to be opened. can anybody please help me in that. Thanks in advance.

Form opening in infopath client despite Content Type settings "Display as a Web Page"

Hi all,   I have a strange behavior with my forms. The infopath template is defined as Content Type for my Form library, in the advanced settings I have checked "Display as a Web page" for the "Opening browser-enabled documents" setting. Despite that when the client is availble on the computer which is browsing the Form Library, I'm asked to "Open", "Save" or "Cancel" instead of opening the form in the browser.   Any idea why this is happening ?

Avoid Opening two instance of Infopath Form which is published to Sharepoint Library


Hi Everyone,

              It would be great if anyone of you answer my question.I have an info path form built in 2007 and published it to share point as a document library.My requirement is i should not allow two instance of the same Form to be opened at the same Time.I mean if you open a form from Share point and If you try to open the next one without closing the previous Form,it should give an alert to user saying that the "Form is already Opened".

I tried like having a Boolean variable which is by default false.If i try to open for the 1st time it should make it as true and for the next time if we refer to that variable and make an alert.But it dint work.Please let me know by anyway i can do this task.Your help will be greatly appreciated!!!!





TIP: Opening an IP Form via a link and supressing the page refresh.


Just a tip I came up with to allow a form to be opened using a link while suppressing the refresh of the page containing the link. 

Below is an example link.  Note the onclick of the link starts with a call to the WSS function DisableRefreshOnFocus(); (from core.css).  The next function in the onclick is the DispEx call that opens the form. 

Another benfit of using the DispEx is that you can suppress the "Open/Save/Cancel" prompt.


<a onclick="DisableRefreshOnFocus();return DispEx(this,event,'TRUE','FALSE','FALSE','','0','SharePoint.OpenXMLDocuments.2','InfoPath.Document.2','1http://my.wsssite.com/myforms/someform.xml?Action=GroupMaint&OpenIn=PreferClient','','2','0','0','0x400001f06fbf1bff')" onfocus="OnLink(this)" href="http://my.wsssite.com/myforms/someform.xm?Action=GroupMaint&OpenIn=PreferClient"><img alt="Click to edit the Personnel record for this person"  border=0  src="http://my.wsssite.com/_layouts/images/icxddoc.gif"/></A>


Opening model form specific to the tab



I have the tabcontrol, in which i have two tabpages. I embed the form in "TAbPage1" and i want to open the model popup specific to that form embeded in the "TabPage1". Meanwhile, i should be able to access the tab.

Basically, i want to open the model popup which is specific to that tabpage and it should not be model to the undelying form which has the tab control.

I tried with the below code, but it doesnt work


private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)




Catastrophic failure while opening DIP form in Infopath



while opening my content type's DIP in infopath, it shows 'Catastrophic failure'.

while searching, i have found the reason for this,

While doing this so, you may be facing an ugly error Catastrophic failure error. Dont worry about this error... this is because of the columns in your content type. While creating a column in content type, that column should not contain any space(s). For example, you created a content type named "Test Document" and the site column you use is "Test Column". Then this content type will face the catastrophic failure error.

the columns are already being used.please guide me to solve this issue.

Thanks in advance.

Problem opening an attachment from Infopath 2007 form in SharePoint 2010

I have an InfoPath 2007 form that is opened as a web based form in SharePoint 2010 that has an attachment control.  In Windows XP with IE 7 when you double click the attachment there is a warning message presented and after you click OK you get a prompt that asks if you want to open or save the file or cancel.  In Windows 7 with IE 8 when you double click the attachment there is a warning message presented and after you click OK you get a prompt that asks if you want to save the file or cancel, no open option.  I already set the SharePoint browser permission to permissive for the site and it doesn't help.  How can I get this to work in Windows 7 and IE 8?

how to call a webservice upon opening form from library?



I have infopath forms in sharepoint library. When i open a submitted form, i want to call a webservice, how can i go about to achieve that?

What i have done so far is:

1. set a rule on a certain field

2. call the web service when that field gets populated

3. however, webservice is not called because my web service will output into a log file, but there's no output

Some times FormEvents_Loading() is not firing when opening infopath form in browser.


Hi All,

I am facing problem in infopath form published in form library. There are 5 different view depending on the user.

Sometimes the FormEvents_Loading() is not getting invoked. As i check using log function on every setp inside formevent_loading().

But when i click refresh button on browser,it works fine.

This is creating problem with users as they see wrong views.

Pls Advise how can i resolve this..



-- Regards Sandeep

Values in repeating rows being replaced after opening the form a second time


I have a couple Infopath forms and recently they started behaving oddly.

In each of them there is a repeating row. In each row you enter a work order as the first value/column, this then filters the second column which is a drop-down with the various items on that work order. The remaining rows are then descriptions of those select items respectively. This information is all retrieved from a single SQL connection.

It all looks great, you click submit (It submits those values to a SharePoint list) and is then saved in the document library. However if you open the form after the values in each of the repeating row has reverted back to the first item for the selected work order.

For example: I enter work order 3344 which consists of items x, y, and z. In the drop down I can select item x, for the second item, I select y, and then z for the third for a total of 3 rows I then click submit.

If I open the form again the correct work order is still displayed but the three rows are all showing details for x, the first item in the work flow.

Does anyone have any idea what could be doing this? Thanks in advance!

Browser Based Infopath form Opening Problem



 I am having some problem regarding infopath form.Actually i m using Browser based infopath form.

 I created the browser based infopath form and then i choosed full trused and added the certificate and then published with admin approved and then installed and activated from the central admin.

if client machine is having the Infopath Installed on that machine, I m facing some prob to open that infopath form on the client machine(asking windows crediantial again and again and at last the form was opended but the webservice was not retrieving the data on the infopath form) .

But if the client machine is not having the infopath installed then the infopath form is opening in single click.there is no issue in this case.

 so can u confirm me that if we are creating browser based infopath from then the client machine should not have infopath installed on that machine. Is this right?

Actually i m working on client site and lot of..... 1000 machines is here and every machine is having infopath form installed. So will every machine need uninstall of infopath?

Pls try to give me the solution.


Regards- Sharad

Business Contact Manager issue - Not opening 'new contact' form or any existing contacts.


I'm hoping someone can help with this issue, its rather urgent.

We use Business Contact Manager 2007 installed on Small Business Server 2008 using Windows 7 clients which integrate with Outlook 2010.

This has happened a couple times but each time has seemed to resolve itself, however it is not resolving itself this time. Whenever the user tries to create a new contact in Business Contact Manager nothing happens. The button preses but then the window doesn't appear. Same thing happens if they try to open an existing contact card in their address book for contact manager. The contact cards on their normal address book work fine.

Have double checked the share for the database is still ok and restarted the database and the exchnage service but they still cannot open any of the existing contacts or create new ones.

Happens on all the PC's in the office.

Any help would be appreciated.

Have turned on logging and can email the log if required.

JQuery Validate plugin to validate a ASP.NET Form

The first time I used the JQuery Validate plugin, it did not work at all, see JQuery Validate odd behaviour with the ASP.NET Script Manager for reason, but perseverance and stubbornness prevailed and I finally created my first JQuery validated ASP.NET Forms contact form.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend