{"id":459,"date":"2016-02-18T12:25:21","date_gmt":"2016-02-18T17:25:21","guid":{"rendered":"http:\/\/markwheeler.com\/wordpress\/?p=459"},"modified":"2016-02-18T12:25:21","modified_gmt":"2016-02-18T17:25:21","slug":"submitting-datetime-with-infopath-to-web-services","status":"publish","type":"post","link":"https:\/\/markwheeler.com\/?p=459","title":{"rendered":"Submitting Date\/Time with InfoPath to Web Services"},"content":{"rendered":"<p>I created an Infopath for users to request teleconference numbers.<br \/>\nI have two lists; Schedule and Conference List.<\/p>\n<p>Schedule list had these columns: Title, Start Date, End Date, Attendees, Status, Assigned.<br \/>\nConference List had these columns; Source (which will be set to Title above), Title, Phone Number, Start Date, End Date<\/p>\n<p>Users get a standard request form which pulls and updates from the Schedule list.<br \/>\n<a href=\"http:\/\/54.159.73.21\/wp-content\/uploads\/2016\/02\/ConReq.png\" rel=\"attachment wp-att-460\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/markwheeler.com\/wordpress\/wp-content\/uploads\/2016\/02\/ConReq-300x92.png\" alt=\"ConReq\" width=\"300\" height=\"92\" class=\"alignnone size-medium wp-image-460\" srcset=\"https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/ConReq-300x92.png 300w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/ConReq.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Admin\/Operators receive workflow email that a request was placed and get an expanded form. <\/p>\n<p><a href=\"http:\/\/54.159.73.21\/wp-content\/uploads\/2016\/02\/ConOpView.png\" rel=\"attachment wp-att-472\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/markwheeler.com\/wordpress\/wp-content\/uploads\/2016\/02\/ConOpView-267x300.png\" alt=\"ConOpView\" width=\"267\" height=\"300\" class=\"alignnone size-medium wp-image-472\" srcset=\"https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/ConOpView-267x300.png 267w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/ConOpView.png 744w\" sizes=\"auto, (max-width: 267px) 100vw, 267px\" \/><\/a><\/p>\n<p>The magic is on the Assign button on the Operator section.<br \/>\nRules are set to submit 5 values to the Conference List using a Web Service.<\/p>\n<p>There are many good blogs that detail this process.<br \/>\nReference with Screenshots: <a href=\"http:\/\/jaliyaudagedara.blogspot.com\/2011\/03\/submitting-data-to-sharepoint-2010-list.html\">http:\/\/jaliyaudagedara.blogspot.com\/2011\/03\/submitting-data-to-sharepoint-2010-list.html<\/a><\/p>\n<p>The first step is to create an &#8220;Add List Items.xml.&#8221; This is the data to be inserted into the Conference List:<\/p>\n<pre>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Batch OnError=\"Continue\">\n    <Method ID=\"1\" Cmd=\"New\">\n        <Field Name=\"Title\"><\/Field>\n        <Field Name=\"Source\"><\/Field>\n        <Field Name=\"Number\"><\/Field>\n        <Field Name=\"Start\"><\/Field>\n        <Field Name=\"End\"><\/Field>\n    <\/Method>\n<\/Batch>\n<\/pre>\n<p>The easy part is submitting text fields. Date\/Time fields will fail due to invalid type errors. A common problem I&#8217;ve seen reported is that you won&#8217;t get an error on submit and no data will be posted to your list.<\/p>\n<p>This the workaround for Date\/Time.<br \/>\nCreate a textbox on your form; you can hide this later.<br \/>\nSet the value to your original form&#8217;s time value with the following formula.<\/p>\n<pre>\nconcat(YourTimeField,\"Z\")\n<\/pre>\n<p><a href=\"http:\/\/54.159.73.21\/wp-content\/uploads\/2016\/02\/TimeField.png\" rel=\"attachment wp-att-469\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/markwheeler.com\/wordpress\/wp-content\/uploads\/2016\/02\/TimeField-300x274.png\" alt=\"TimeField\" width=\"300\" height=\"274\" class=\"alignnone size-medium wp-image-469\" srcset=\"https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/TimeField-300x274.png 300w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/TimeField.png 414w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This is the important piece. The UpdateListItems call needs that &#8220;Z&#8221; appended to the Time portion.<br \/>\nYour modified time output will look like YYYY-MM-DDTHH:MM:00Z.<\/p>\n<p>When creating your Submit to Web Service rule; add the Submit portion first. In my example the rule is &#8220;AssignNumber&#8221;.<br \/>\nGo 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.<\/p>\n<pre>\n<xsf:assignmentAction targetField=\"xdXDocument:GetDOM(&quot;Add List Item&quot;)\/Batch\/Method\/Field[@Name = &quot;Title&quot;]\" expression=\"d:Title\"><\/xsf:assignmentAction>\n<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>\n<xsf:assignmentAction targetField=\"xdXDocument:GetDOM(&quot;Add List Item&quot;)\/Batch\/Method\/Field[@Name = &quot;Number&quot;]\" expression=\"d:Number\"><\/xsf:assignmentAction>\n<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>\n<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>\n<\/pre>\n<p>This allows you to set your Add Item CAML to push the correct values to the Web Service Submit. <\/p>\n<p>From InfoPath Designer; open the manifest.xsf file. Your rules may look like this.<\/p>\n<p><a href=\"http:\/\/54.159.73.21\/wp-content\/uploads\/2016\/02\/ConAsnRules.png\" rel=\"attachment wp-att-470\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/markwheeler.com\/wordpress\/wp-content\/uploads\/2016\/02\/ConAsnRules-300x262.png\" alt=\"ConAsnRules\" width=\"300\" height=\"262\" class=\"alignnone size-medium wp-image-470\" srcset=\"https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/ConAsnRules-300x262.png 300w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/02\/ConAsnRules.png 617w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[10,11],"tags":[58,99],"class_list":["post-459","post","type-post","status-publish","format-standard","hentry","category-sharepoint","category-software","tag-infopath","tag-sharepoint-2010"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/posts\/459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=459"}],"version-history":[{"count":0,"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/posts\/459\/revisions"}],"wp:attachment":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}