2

I have a share point custom web part which has 2 text box Name and ID and a button. I have a info path form called 'EmpInformation' in the form library.So if the user hits on the button, a new info path form should be opened and Name and ID fields in that form should be populated by the data send by button. any suggestions


3

You can use Query String parameters to send to InfoPath form and if you want no code solution, you can use Query String (URL) Filter Web Part.. Following blog shows how:

How to Pass Querystring data into an InfoPath Form

If you want to access them in code, you can access like:

// URL: http://www.foo.com/bar.xsn?xyz=1

public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
   // Assign the value of the parameter 'xyz' to the string 'xyzValue'
   string xyzValue = e.InputParameters["xyz"];
}
|improve this answer|||||
  • great, i will try this out. Is there any limitation in terms of how many parameters(or characters in URL) we can send? – spStacker Mar 9 '14 at 21:42
  • 1
    Yes, it shouldn't be used for large strings.. stackoverflow.com/questions/417142/… – Arsalan Adam Khatri Mar 9 '14 at 22:30
  • oh i see - as of now not sure how many parameters we are planning to pass in querystring, but if it is more, is there any other approach? – spStacker Mar 9 '14 at 23:15
  • It should be good for Name and ID, not sure of any other methods.. Let someone else jump in.. – Arsalan Adam Khatri Mar 10 '14 at 8:36
  • As per our requirement - We would need to just pass one parameter from webpart in query string and then in infopath use that parameter to query a database to get all the attributes related to it – spStacker Mar 13 '14 at 13:30
3
+50

One idea can be to store the data in a List (maybe temporarily) and on InfoPath form make a connection to this List, get data from there.. If you have multiple entries in List and need to identify which one you should pick, you can still use QueryString approach to send the List Item Id..

|improve this answer|||||
  • Is this a new answer, or questions to the poster, or an addon to your original question? – Robert Lindgren Mar 13 '14 at 17:30
  • Its a new answer :).. Question mark might have confused you.. Actually its more of a suggestion (answers are suggestions, if I'm not wrong).. But of course it is completely different from my first answer, so should be separate! – Arsalan Adam Khatri Mar 13 '14 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.