Filtering InfoPath drop-down list on previous, future selections

 Sharepoint, Software  Comments Off on Filtering InfoPath drop-down list on previous, future selections
Feb 252016

Another requirement for my teleconference reservation form was to only allow one unique user to be assigned to a number.

I had to figure a way to filter or exclude previously selected users from other drop-down box selections.

My user drop-down is populated via the Attendees people picker field from the Main datasource.


I then created a filter on the Person group datafields to limit the drop-down options displayed.
The actual expression is:

not(pc:DisplayName = xdXDocument:getDom("ConferenceMaster")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:User)


The resulting form looks like this; Only when Assign is clicked do the following drop-down boxes filter.



For reference, my Assign button rules are depicted here:


Submitting Date/Time with InfoPath to Web Services

 Sharepoint, Software  Comments Off on Submitting Date/Time with InfoPath to Web Services
Feb 182016

I created an Infopath for users to request teleconference numbers.
I have two lists; Schedule and Conference List.

Schedule list had these columns: Title, Start Date, End Date, Attendees, Status, Assigned.
Conference List had these columns; Source (which will be set to Title above), Title, Phone Number, Start Date, End Date

Users get a standard request form which pulls and updates from the Schedule list.

Admin/Operators receive workflow email that a request was placed and get an expanded form.


The magic is on the Assign button on the Operator section.
Rules are set to submit 5 values to the Conference List using a Web Service.

There are many good blogs that detail this process.
Reference with Screenshots:

The first step is to create an “Add List Items.xml.” This is the data to be inserted into the Conference List:

<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Continue">
    <Method ID="1" Cmd="New">
        <Field Name="Title"></Field>
        <Field Name="Source"></Field>
        <Field Name="Number"></Field>
        <Field Name="Start"></Field>
        <Field Name="End"></Field>

The easy part is submitting text fields. Date/Time fields will fail due to invalid type errors. A common problem I’ve seen reported is that you won’t get an error on submit and no data will be posted to your list.

This the workaround for Date/Time.
Create a textbox on your form; you can hide this later.
Set the value to your original form’s time value with the following formula.



This is the important piece. The UpdateListItems call needs that “Z” appended to the Time portion.
Your modified time output will look like YYYY-MM-DDTHH:MM:00Z.

When creating your Submit to Web Service rule; add the Submit portion first. In my example the rule is “AssignNumber”.
Go to Publish and Export Source Files. You will need to edit the manifest.xsf. Find your submit rule by name and paste the following BEFORE the submitAction.

<xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;Add List Item&quot;)/Batch/Method/Field[@Name = &quot;Title&quot;]" expression="d:Title"></xsf:assignmentAction>
<xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;Add List Item&quot;)/Batch/Method/Field[@Name = &quot;Source&quot;]" expression="xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:Title"></xsf:assignmentAction>
<xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;Add List Item&quot;)/Batch/Method/Field[@Name = &quot;Number&quot;]" expression="d:Number"></xsf:assignmentAction>
<xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;Add List Item&quot;)/Batch/Method/Field[@Name = &quot;Start&quot;]" expression="xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:TimeStart"></xsf:assignmentAction>
<xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;Add List Item&quot;)/Batch/Method/Field[@Name = &quot;End&quot;]" expression="xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:TimeEnd"></xsf:assignmentAction>

This allows you to set your Add Item CAML to push the correct values to the Web Service Submit.

From InfoPath Designer; open the manifest.xsf file. Your rules may look like this.


You can edit the value of these rules as necessary. Note that I point my Start and End Date columns to the concat fields I created earlier.