Tag : sharepoint

InfoPath – Using a field to identify Form Load issues

When you open many data connections and perform queries through the ‘Form Load’ functionality in InfoPath, it may be that your form takes long to open. To troubleshoot these issues, you can create a local field in InfoPath and write the rule and time to this field each time an action is performed. When the form finally opens, you can query this field to see where the lag is. Example:

  1. Separate your Form Load into multiple rules, grouped by logical function such as ‘Getting Initial User Data’ or ‘Query Attachments’
  1. Add a text field called ‘Log’ and at the very beginning of the first rule, initialize it with something similar to the following:

concat(“Getting Initial User Data:”, string(now()), “,”)

  1. Then, at the beginning of each subsequent rule, and perhaps sometimes within the rule itself, set the field ‘Log’ to a value similar to the following:

concat(Log, @crlf, “Query Attachments:”, string(now()), “,”)

(Note that the field @crlf which formats the field neatly, originates from an XML Data Connection. See ‘InfoPath – Adding special characters such as line feeds’ for more information on how to do this)

  1. Display the ‘Log’ field somewhere on your form (I normally add this to a special view that only administrators have access to – the button to open this view is not displayed if the user is not an administrator
  1. When you view the field, it will have something like the following in it

Getting Initial User Data:2016-05-30T15:54:02,
Query Attachments:2016-05-30T15:54:02,
Query Related Documents:2016-05-30T15:54:02,
Query Item Prices:2016-05-30T15:54:17,

From the above, we can see that there is a problem with the Query on Related Documents since it is taking almost 15 seconds to process based on the time that the ‘Query Item Prices’ is starting

InfoPath – Getting data from a spreadsheet into InfoPath

Data in an Excel sheet is unstructured and often split across multiple tabs. The users I was dealing with were flexible enough to use a couple of cut-and-pastes from Excel into spreadsheet to get this option working. This is what I did to allow the users to import the data:


  1. Create a separate folder in the Excel spreadsheet for importing the data, called ‘SPImport’.
  2. In row 1, add column headings for each cell that you wish to import. This is so you can easily identify which property is in which cell
  3. In row 2, add a regular Excel expression to point to the cell that contains the data (examples: =Data!A16, =Data!D24 etc.). You can add some additional functions in the row to strip of unneeded characters that could cause a problem in SharePoint loads, including hidden spaces, linefeeds, forward and backward slashes, quotation marks etc.
  4. You will probably need to make a couple of the fields ‘key fields’, meaning that they will contain values that uniquely identify the import
  5. In the end you will have a single row of data that will auto populate with the referenced cells values. This spreadsheet should then become the master spreadsheet for the data
  6. Now, create a SharePoint list, say called ‘SPExcelImport’ that contains the same columns as your spreadsheet and the default Datasheet view in exactly the same format. You may choose to auto populate the Title field or use it to hold one of the values you intend to import.
  7. In your InfoPath form, create a Data Connection to the ‘SPExcelImport’ SharePoint list, provisioning all the fields
  8. In my form I added an ‘Import Button’ that was only enabled when I can find an entry in the ‘SPExcelImport’ list with matching key fields
  9. When the user clicks on the Import button, set the values in the form to the values in the import file (I was dealing with over 100 fields in my example, so I split the Action on the Import button into multiple rules)


  1. The user completes the spreadsheet
  2. The user opens the ‘SPImport’ folder, highlight the cells in Row 2 that are needed and selects Ctrl-C to copy the data (They should not highlight the entire row as this will attempt to copy all the columns in the row into the spreadsheet and the user will receive an error)
  3. The user opens the ‘SPExcelImport’ table with the cursor on the first cell and presses Ctrl-V to paste the copied values into the SharePoint list. This will paste the cells from the spreadsheet into the SharePoint cells (Sometime, you may find that it copies all the data into a single cell. When this happens, tab out of the cell, shift-tab back in and do the copy again). Stop editing the list
  4. The user then opens the InfoPath form and enters the key data in the header. InfoPath queries the ‘SPExcelImport’ list with the key data and if an entry is available, enables the import button
  5. The user then clicks on the Import button to import the data

InfoPath – Preventing updates to the form when the workflow is updating

This applies to lists that are linked to workflows. Since the workflow and InfoPath form are separate processes, it is possible that users can update the form while the workflow is processing data. This ability to update the form gives the user the impression that the updated data is considered and while this is true in some cases, it can be an issue if the workflow is only initiated when items are added to the list, as the workflow may be running based on previous values

To prevent this from occurring, I use a promoted field called ‘Updating’ in the form to test whether the workflow is in the process of updating. When the workflow is updating information, this value is set to ‘true’. When the user opens the form during this stage, the forms checks this value and if it is set to ‘true’, the updating buttons (such as ‘Approve’ or ‘Reject’) are disabled, thus preventing the user from making any adjustments. Additionally, a message can be displayed to inform the user that an update is happening. I normally set this value in the form itself since I am aware than an update is about to occur. This is necessary as the workflows take time to start, and the user could open and update the form prior to the workflow setting this value

In my workflows whenever an update is required from the user, the promoted field ‘Outcome’ is set to 0 and the field ‘Completed’ is set to ‘false’. When the user selects a button to approve or reject the data, the system sets this value to 1 or 2 and sets another field ‘Completed’ to ‘true’. This indicates that an update has been made (based on the workflow action ‘Wait for Field Change in Current Item’) and the workflow can resume and make decisions using the chosen selection.

InfoPath – Hyperlinks with ‘Page not found’ or how to deal with URL’s with spaces

InfoPath will allow you to display links to external files (such as attachments in a list accessed through a Data Connection), but if those URL’s have spaces in them (as many user files do), it could be that when you click on the link you get the ‘Page not found’ message as shown below


This could be happening because you have used the Hyperlink found in the Control Tools instead of the Hyperlink found in the ‘INSERT’ tab in InfoPath. Pretty weird! Anyway, use this method to make sure your linked content displays correctly

Create a Data Connection link to the table that has the attachments.

Make sure to select the attachment in the list of fields as shown below


Drag the table onto your form to create a Repeating Table control


Arrange the columns

Arrange the columns in the format you want and delete any unneeded columns like the ID AND the attachment column (You delete the attachment column as we will add it later and you do not want duplicate links, especially ones that do not function correctly). Insert a column to the Left or Right at the point where you want the Hyperlink. In the image shown below, you will notice that the last column, which I titled ‘Attachment link’ is empty. Your form should look similar to the following


Create the Hyperlink

Place your cursor in the empty cell in the repeating table, switch to the INSERT tab and select the ‘Hyperlink’ button …110-5

This will open up a dialog box for you to complete as follows


In the dialog box for the Link to section, select ‘Data source’ and link the Data Source to the attachment as shown above (in most cases the system will automatically default to the attachments

In the display selection you will probably want to select ‘Data source’. You can then use the Field selector to display the attachment URL or some other detail available in the data connection, or you could use a formula similar to the one below to reduce the size of the URL and only show the last section


This formula will show the portion of the attachment that follows ‘Attachments/’ – in this case the file name associated with the attachment. This is useful since you do not want to display a URL that is a mile-long and that the users will have problems understanding

Publish the form

Publish the form, and when you click on the link, the image should display with no error

InfoPath – Prepopulate a list item from a URL

In a previous post (InfoPath – Link to a list item from a URL) i detailed how to open a list item directly from a URL in a form. In some cases (actually many cases) it may be necessary to fill out the new form with data that comes from the calling form. For example, if you are adding attachments, you may want to pre-define the key of the ‘parent’ list

Basically, the ‘calling’ form defines a URL that includes as it’s suffix a parameter that specifies the data that is to be used when pre-populating the form. Also, when the user clicks on the URL, the system will use the ‘Query String (URL) filter’ Web Part to pass this value to an ‘InfoPath Form’ Web Part

Here are the steps involved

Define a field in your calling form to hold the URL you will use

In my example I added a text field called ‘URLAttachment’ as shown below


Click on the fx button to open the Formula dialog box and specify the formula as follows


Key values in this formula:


This is the name of the list that you would like to link to and open with pre-populated data. My list name is ‘FA Attachments’


The name of the view that the URL must open followed by .aspx. We will define this view later, but if you choose a different name in SharePoint, you will need to modify this value as well


This specifies the name of the parameters that are being passed. In my case, I call these values ‘Details’ (This name will be used later  in the Filter (URL) Web Part)


The value of the ‘Details’ parameters. Since the ‘Details’ parameter passes a single string value, I concatenate my data using  ‘<‘ and ‘|’ as delimiters so that I can easily separate the Season, Product and ID from the passed value in the called list. In the online documentation you will notice that it is not a simple task to pass multiple parameters and concatenating all your parameters into a single passed value makes it a simple task

Note. Be aware that WordPress modifies the standard quotation marks based on the display (not edit) font, so if you are cutting-and-pasting, you will need to change them back to standard format

Add a hyperlink field in your form

Add a hyperlink field in your form to link to this URL.


Select the INSERT tab, then click on the Hyperlink button and a screen similar to the following will be displayed


Select the ‘Data source’ radio-set and then use the ‘Select XPath’ button (highlighted above) to select the URL Field (in our case ‘URLAttachment’). Type some text into the Display Text fill-in so that it is clear that the user needs to click on this hyperlink to add an attachment

Your form will now display a Hyperlink to the appropriate list item as shown below in this section pasted from the form


The changes to the calling form have been completed – we now need to make some changes to the called form and the page in which it will be displayed

 Add a field to the ‘called’ List that will ‘contain’ the parameters that will be passed in the URL

Create a text field in the list that will be used to contain the passed parameters (this field will not be used for anything else – read my blog on InfoPath – Temporary fields in InfoPath form if you do not want to define additional fields in your list). In my case I created a single line of Text field called PassedParameters as shown below


 Define Rules for the field in the ‘called’ form

I then add the field to the called form and add the following rules

Formatting Rule to hide the field

I add a simple formatting rule that will always be true to hide the field as follows (Initially you may want to display the values in PassedParameters to make sure they are coming across correctly – in this case you can add the ‘Hide’ rule to the form after everything is running correctly)


Action Rule to update data when PassedParameters changes

The PassedParameters field will be automatically updated later, but in the form we need to decide what to do with the data it receives. In my case, I use the InfoPath substring-after function to get the ID of the document that this attachment relates to. With this value I can then query the list and set the default data in the form as shown in the screen shot below


Create a view on the list specifically for the URL

In SharePoint, create a view on the ‘called’ list that the URL will call. In my case, I named the view ‘Direct’ (To match my URLAttachment defined in the calling InfoPath form). Initially the View will look something like this (perhaps with some data underneath the headings):


Add the necessary Web Parts to your screen

From the Setting (Gear) icon, select ‘Edit Page’ as shown below


This will open a screen that looks similar to the following. Click on the ‘Add a Web Part‘ link


A screen will be displayed:


In the ‘Categories’ section, select ‘Forms’ and then choose ‘InfoPath Form Web Part’. Click on the ‘Add’ button  and the InfoPath Form Web Part will be added to your screen as shown below


Ultimately, this Web Part will display your form. Now we need to add another Web Part to the screen that will move the Parameters from the URL to the PassedParameters field that we created earlier. Click on the add button again as shown above and a screen similar to the following will be displayed


 In the ‘Categories’ section, select ‘Filters’ and then choose ‘Query String (URL) Filter’. Click on the ‘Add’ button and the Query String (URL) Filter Web Part will be added to your screen as shown below


Configure the Web Parts to update the PassedParameters  field

We now need the web parts to talk to each other. In the InforPart Form Web Part, click on the ‘Click here to open the tool pane’ link. A window will open on the right of the screen. In this window, set the List or Library to the list item that is being called (in my case this is FA Attachments) and set the ‘Content Type’ to ‘Item’. Leave all the other fields defaulted and then click on the ‘OK’ link at the bottom of the window to save your changes.


Once you click OK, you will notice that the input screen of your list is displayed as shown below


Now that the InfoPath Form Web Part has been configured, we need to link the passed URL parameters to this form. Click on the ‘Open the tool pane’ link (Shown in the image above highlighted with a red border). A Screen similar to the following will  appear


In the ‘Query String Parameter Name’ enter the name of the parameter that you want to pass to the InfoPath form. In our case, the data we wish to pass (to PassedParameters) is all contained in the parameter ‘Details’. Leave the other fields as they are and click ‘OK’ and the Query String (URL) Filter will change slightly and display a message that the filter is not connected. This is expected


Now, let’s connect the filter. In the top right of the ‘Query String (URL) Filter there is a small drop down indicator. Click on this indicator and you will notice that the menu has a ‘Connections’ option. Select ‘Connections’, then ‘Send Filter Values To’, then ‘InfoPath Form Web Part’, and a screen similar to the following will appear. Select the field ‘PassedParameters’ that we defined earlier (you will notice that other fields from your list are also available)


Click on ‘Finish’.


The job is completed and the ‘Called’ form will now open automatically with the pre-populated data when the link in the ‘Calling’ form is selected

Open your calling form

You are ready to test. Open your ‘Calling’ form and click on the link you defined and the ‘Called’ form should display as shown below (names and places have been changed to protect the innocent!)


InfoPath – Link to a list item from a URL

It is possible to open another list item directly from the form in another window. This can be useful when you wish to link to related items in another list or add another list item. This is done by building a URL that points to the list that you wish to link to. While the building of the URL can be performed directly in the Hyperlink Data Source, I have found that it is clearer to build the link in a field and then tie the Data source directly to the field.

Add a text field to contain the URL

Add a text field to the form, in the example below I added the field ‘URLAttachment’. Note that the checkbox ‘Refresh value when formula is recalculated’ is checked


Using the fx button,set the default value to one of the following

To open the window in ‘Insert/Add’ mode:

concat(SharePointSiteUrl(), “Lists/<List Name>/item/newifs.aspx”)


Ultimately, the concatenation statement would yield something similar to:


To open the window in Edit mode (ID = the ID of the item you wish to open):

concat(SharePointSiteUrl(), “<List Name>/Forms/EditForm.aspx?ID=235”)


Ultimately, the concatenation statement would yield something like


If you are using an InfoPath form, the concatenation is different since you must open the XML document:

concat(SharePointSiteUrl(), “_layouts/15/FormServer.aspx?XmlLocation=”, substring-after(SharePointListUrl(), “.com”), <FileName>, “.xml&ClientInstalled=true&DefaultItemOpen=1&Source=”, SharePointSiteUrl(), “SitePages/CloseWindow.aspx”)

where <FileName> is the name of the XML file without the .xml extension (you may have to store this value in a variable in your form – mine is shown as File_x0020_Name[ID = OriginalCapex] in the figure below).


NB. The code from ‘&Source=’ onwards is optional and is used to close the window automaticallt when the form is closed (See InfoPath – Close window automatically). Ultimately, the concatentation would yield something like


Create a hyperlink in your form

Enter the text that you want the user to see for the prompt (For example: Click here to add an attachment) into a cell as follows


Tie the hyperlink’s ‘Link To Data Source’ to the created field

Highlight the line you typed in the previous step, right click and select ‘Hyperlink …’. A dialog box will open up. In the ‘Link To’ section, click on the radio-set option ‘Data source’ and then click on the Field Selector button to open up the Field Selection Dialog Box. From this box, select the field that you created in the first step above. Click ‘OK’ to save your settings


Publish the form

The link will now appear as a hypertext as shown below. Publish the form and whenever the hyperlinked text is selected, a new window will open with either the New or Edit form displayed


Notes on the above

  1. If your list has spaces in the name, you need to substitute ‘%20’ for each space
  2. This document was originally defined in MS/Word which sometimes changes the character representation when the font changes. To make sure that the quotation marks don’t change (as I have found they often do), make sure to replace any quotation marks copied from this document with new quotation marks
  3. It may be possible to use a similar URL structure in emails to allow the user to click the hyperlink directly from within the email, but I have come across some issues with buttons being enabled and you may have to use a different URL within emails

InfoPath – Using the filter option

Querying and retrieving data within InfoPath can be confusing mainly because the ‘filter…’ option for data retrieval is sometimes used but not always. This makes it seems like two queries are being used and the beginner will not understand which one takes precedence or when the ‘filter’ option should be used.

The ‘Query using a data connection’ action is the query that populates the data connection, while the ‘filter…’ button used when assigning values to a field assigns a value to a field from a Data Connection that has already been populated. Only the rows returned by the query are available to controls within your form. Rows that have been excluded from the Data Connection (through the setting of a query field) are not available even though they are in the SharePoint list

For example, if in a SharePoint list we have the following table:

Row ID Key Department First Name Last Name
1 P001 IT John Smith
2 P006 IT Lynette Lee
3 Q001 IT Mark Charter
4 Q002 IT Kevin Jenzen
5 Q003 HR Joe Bloggs
6 Q004 HR Sue-Anne Harding
7 Q005 Sales Mike Smith


… and you set the data connection query field ‘Department’ to ‘IT’ and query the table, the system will make the following records available to any control that uses this list

Row ID Key Department First Name Last Name
1 P001 IT John Smith
2 P006 IT Lynette Lee
3 Q001 IT Mark Charter
4 Q002 IT Kevin Jenzen


The other list items (ID’s 5, 6 and 7) will not appear and are not available to any of the controls that access this list. If you want them to be available, you would need to set the query field of ‘Department’ to blank and redo the query

Now consider that we have 4 rows of data in the Data Connection and we wish to display the first and last names of the approver ID selected from a combo. In this case we would need to filter the 4 rows in the data connection to get the correct names to display

You do NOT need to always filter and a good rule of thumb is that if your Data Connection returns a single record, or you do not care about the value, then no filtering is needed. If multiple rows can be returned by the query and you care about the data displayed, then you need to filter

In short, though:

If the connection will return a single record available, do a straight assign

If the connection returns multiple records, do a filtered assign

Straight assign

In the example below I assign the email address of the user from the ‘User Information List’ to a field called ‘CurrentUserEmail’

107-1Here I set the query field Account (which strangely enough displays as ‘name’ in the Rule Details box) to the function ‘userName()’.

Next, I query the User Information list. Since the query will be based on the name of the current user, only a single row from the User Information list will be returned as there is always only one account with the value in ‘userName()’


Now, I want to set and display a field that contains the users email. Since I know the ‘user Information List’ will only be populated with a single row, I can do a straight assign


I use the ‘Insert Field or Group’ button to select the ‘Work Email’ field from the list of available fields in the ‘User Information List (Secondary)’. Since I know that there is only a single record in memory, I do not need to use the ‘Filter Data …’ option. You would click OK all the way through to save your changes


Filtered assign

In the next example, I am working with a form that allows the user to select a Location from a list of locations. I then want to default the Entity value on the form to the default Entity value for that location

Add an action rule to perform the assign statement


Click on the function button to open up the ‘Insert Formula’ dialog box and then click on the ‘Insert Field or Group …’ button

106-18Once you click the ‘Insert Field or Group …’ button, a ‘Field’ selection box will be displayed, initially set to ‘Main’. I use the drop-down arrow to select the list I want – in this case ‘Locations (Secondary). This will display fields similar to the following


I want to get the value of the Entity in my form, however, which location record should I use to get Entity as the system has multiple location records in memory? I had previously selected a location I needed from the list of locations and saved it to the field called ‘CapexLocation’, so now I will use that value to make sure I get the correct entity in my form


To specify which record I need to use, I select the ‘Filter Data…’ button which opens up a form similar to the following. I select ‘Add…’ from the dialog box


This opens yet another window where I specify the criteria to use to select the correct Location record as shown below. I click on the drop down box and select ID (I select ID because my ‘CapexLocation’ field on my form contains Location ID but displays the location name. This can cause some confusion to new users of InfoPath)


I leave the condition as ‘is equal to’ and set the last combo box to ‘Select a field or group …


… and another dialog box opens up allowing me to select the ‘CapexLocation’ from the ‘Main’ group


After clicking on ‘OK’ [more than] a few times, we end up with the following in the Formula dialog box


The system will now return the Entity related to the Capex Location that I had previously selected. You can now click OK once again to finalize your setting. The system will now return the correct entity from the location list based on the location ID in the form

InfoPath – User Information List

You can use the ‘User Information List’ in InfoPath to access details related to the current or other users, such as the users first and last name, email address, title and other useful details.

To get this information do the following:

Add a data connection to the ‘User Information List’

Add a new data connection to Receive Data from a SharePoint library or list106-1

Select the site that that contains the User Information List (iin most cases this is the current site)


The system will display a panel that details current lists and libraries in the site. Scroll down through the lists and libraries and select ‘User Information List’. Click Next


Select the fields that you want to use – mostly this will be the ones indicated in the image below. Click Next


Make sure the ‘Store a copy of the data in the form template’ is unchecked and click Next


Uncheck the box ‘Automatically retrieve data when form is opened’. We uncheck this box because this particular list can be very large and the system would attempt to load all users into the form even though we only require the user information for the person who is currently opening the form. If checked, your form would take longer to open or may even fail to open


The system will default the name. My practice is generally to make two data connections to the UIL – the one to contain the current users information and the other to contain information related to other users. In this case, the second UIL would of course have a different name

Create a ‘Form Load’ rule to read the user information list

In the  InfoPath data area, select ‘Form Load’ to open the pane that shows the rules that execute when the form is opened


Create an action rule with a meaningful name, like ‘Get user details’. This rule should probably be the first rule that executes since you may want to use the information it returns in subsequent rules


We now require two or possibly three separate actions:

The first action specifies the data we are searching on (the query data)
The second performs the search
The optional third action stores the data in another field on the form

Set the Query fields value

The first action of the rule specifies the data we wish to use to query the UIL (If we did not do this, the query data would be empty and ALL records would be returned). Click on the ‘Add’ button and select “Set a field’s value”. A dialog box similar to the one below will be displayed. Click on the ‘Fields’ box highlighted in Red below


A screen like the following will appear. In the top drop-down list, select ‘User Information List’ and then explode the fields below the ‘queryField’ item as shown below. The fields displayed are the fields that you can base your query on.  Since the InfoPath userName() function returns the ‘Account’ data, select ‘Account’ to perform the query based on the current user (In this instance, a single query field is being used, but you can use multiple set field values to query based on any number of fields)


The system completes the name in the Field fill-in as shown below (Do not be alarmed that the system returns ‘Name’ instead of ‘Account’. This seems to be a Microsoft nomenclature problem with the list as the ‘Account’ is the actual field being queried


Click on the fx button to specify a formula to set the Account query field to. A screen similar to the one below will be displayed. Use the ‘Insert Function…’ key to insert the ‘userName()’ function into the formula. Click on the OK button


Your ‘Set a field’s value’ dislog box should now look as follows. This is telling the system to set the Name (Account) in the lists query parameters to the current user name


Perform the query on the User Information List

Now we need to query the data and return the user details to the form.  Select the ‘Query for data’ action from the Add button as shown below


In the screen that is displayed, select the ‘User Information list’ as your ‘Data connection’ as shown below


The system will now query the user information list based on the current user name (account) to make the first name, last name and any other user attribute available to the InfoPath form

Set an InfoPath field to the current users name

Now let’s set a field’s value to the name of the user. Once again choose ‘Set a fields value’ from the ‘Add’ button


 In a similar way to before, click on the ‘Fields’ box highlighted in Red below to enable you to choose a field from the selector


Select the field whose value you want to set, by selecting ‘Main’ and then choosing the field. In the example below I am setting my CurrentUserName (which I subsequently access through a workflow so that I know who the last person was to update the form)


Once again, click on the Function button fx  to open up the formula box and then select ‘Insert Field or Group’ so that we can move the value in the query that was completed previously into this field


A dialog box similar to that shown before is displayed. In the ‘Fields’ section select the User Information List and explode the tree so that you can see the fields under ‘dataFields’ as shown below (The ‘queryFields’ only contains the data you used for the query, while the dataFields contain all the rows returned by the last query)


Select the ‘Name’ of the user. A note on names: In many cases, the SharePoint data comes in the not so friendly format of ‘Last Name, First Name’. You can use the ‘concat()’ function in your formula box with the ‘First name’, ‘ ‘ and ‘Last name’ to create a more user friendly version of the name, but beware: External users (Those signing onto SharePoint through other accounts) will have empty ‘First name’ and ‘Last name’ fields

Your ‘Formula’ box should now look like this (you will notice that the name says ‘Title’ instead of ‘Field’, but don’t be concerned as this is that nomenclature thing again)


Click OK to save your Formula

Notes and tips

  1. Once you perform a Query action, the rows of the list that are returned remain in memory, so you can refer to them directly without having to run another Query action
  2. I suggest that you always use the data connection to return the single row of data based on the current userName(). If you need to select a user from a list of users, I suggest you create another Data Connection to the same ‘User Information List’ (give it a different name of course) and then link your combo-box or repeating table to this new list. Be sure to set your query parameters to only return the rows you want
  3. I believe it is good practice to save the current user name in the form so that it is possible to get the identity of the user who last changed the data, in either the form, workflow, or SharePoint view.
  4. If you require additional user information that is not in the User Information List, you may need to create a User List for those particulars. This would be a standard SharePoint app, keyed on the email address of the user so that it is a simple process to access the user details in InfoPath through a Data Connection to this table

UserName() function

The userName() function returns the identity of the user currently accessing the formExamples of the data format returned:

Internal users: ‘i:0#.f|membership|melsmith@contoso.com

External users: ‘i:0#.f|membership|msmith_gmail.com#ext#@contoso.onmicrosoft.com

In preview:      ‘136909

Note that in preview, this function may return a value in a very different format from the one it returns when not in preview, which means that you will not be able to properly test user related functionality in preview.

Workflow – Use the App Step in workflows

In most cases I want my workflows to run with full-control on the site, so that they can read and update any list mentioned in the workflow, so ALL my stages function within an ‘App Step’. Without this ability, the workflow runs with the rights of the person who initiated it and this can result in a suspended workflow if the individual does not have the rights to read or update a record on a particular table. If this happens, the workflow hangs and no-one is the wiser unless they examine each workflow every day

To see how to do this, follow the easy to use and comprehensive guidelines given through the Microsoft URL Create a workflow with elevated permissions by using the SharePoint 2013 Workflow platform . Also, take a look at my post on Workflow – Scoping the App Step to specify the scope correctly if you are using sub-sites or wish to access data across the Site Collectiion