For eg: I want to add user email in one of infopath form fields from the user who has logged in. Can it be picked from user profile service, but how do display it ?
Yes you can. This assumes you want to show the users login Username email address?
For example. You can create Two fields in the Fields Side bar, call one something such as "
h_sp_account_email_only" and the other
Now click the Data Tab and at the top right there should be an option called Form Load. Click it and it will allow you to set a rule.
Click new. Choose "Action". Now under run these actions. Select "Set a fields Value" --> The Field that you want to set is the "
h_sp_account" field you have just created. Now select the "Fx" and choose "Insert Function" tab. Now select
Username and then click ok.
Next you want to set another fields value. Select The field you want to set which will be "h_sp_account_email_only" Now click the Fx button and copy and paste this part in.
h_sp_account is a field and you will need to double click it and select your
h_sp_account so the query knows where to find it.
Now just drag and drop the h_sp_account_email_only field where you want the email of the person logged in to show. Save & Publish the form.
When you open the form after publishing it should now show the email address of the person whose opened the form :)
Hope this helps!