Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)? - InfoPath Dev
in

InfoPath Dev

Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

Last post 06-14-2007 03:46 PM by Matt Faus. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 06-11-2007 10:50 AM

    • jeagly
    • Top 500 Contributor
      Male
    • Joined on 06-05-2007
    • Huntsville
    • Posts 37

    Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

    I am trying to submit a from InfoPath to a list in SharePoint. Can I create a connection between the drop down list box in InfoPath and the choice box in SharePoint? It appears that the only way to submit to SharePoint is if all column types are single line of text. Is that correct?

    Jack Eagly
  • 06-14-2007 01:41 AM In reply to

    Re: Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

    Hi Jack,

    I don't think I fully understand your question.  You can submit to a SharePoint list from InfoPath, and we have several very long threads as well as a blog post on how to do this.  It's a little complicated, but it can be done.

    The only data type issue I've heard about submitting to SharePoint is with RichText columns, and possibly dates.

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-14-2007 09:39 AM In reply to

    • jeagly
    • Top 500 Contributor
      Male
    • Joined on 06-05-2007
    • Huntsville
    • Posts 37

    Re: Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

    Hi Matt,

    I created an Issues list in SharePoint to track Action Items, assignees and status etc. I want to update the list via InfoPath. I used the CAML method to UpdateListItems. In SharePoint there are several DDLs identified as choice types, Status being one of them. I want to update the choice type via DDLs from InfoPath. How do I do that? I've searched the forum. I am begining to wonder if I need to use the UdateList method rather than the UdateListItems.

    I am slowly learning XML: I
    want Status field in InfoPath to share the choice column in SharePoint. I have found some posts on what I thought would create the FieldName as Type Lookup, but on preview, all that displays in the DDL is Lookup.

      <?xml version="1.0" encoding="UTF-8" ?>
    - <Batch OnError="Continue">
    - <Method ID="1" Cmd="New">
    - <Fields>
      <Field Name="PPCEID" />
      <Field Name="PPCENumber" />
      <Field Name="Description" />
      <Field Name="AssignedTo" Type="Lookup" />
      <Field Name="Status" Type="Lookup" />
      <Field Name="DueDate" />
      </Fields>
      </Method>
      </Batch>
    Thanks!

      <?xml version="1.0" encoding="UTF-8" ?>
    - <Batch OnError="Continue">
    - <Method ID="1" Cmd="New">
    - <Fields>
      <Field Name="PPCEID" />
      <Field Name="PPCENumber" />
      <Field Name="Description" />
      <Field Name="AssignedTo" Type="Lookup" />
      <Field Name="Status" Type="Lookup" />
      <Field Name="DueDate" />
      </Fields>
      </Method>
      </Batch>
    Thanks!
    Jack Eagly
  • 06-14-2007 11:59 AM In reply to

    Re: Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

    Hi Jack,

    You can't submit Lookup types to SharePoint.  I still don't think I understand your problem - can you attach an XSN so I can take a quick look?  I haven't worked with SharePoint CAML too much, so I'm not sure how much help I will be, but I can try.

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-14-2007 02:20 PM In reply to

    • jeagly
    • Top 500 Contributor
      Male
    • Joined on 06-05-2007
    • Huntsville
    • Posts 37

    Re: Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

    Hi Matt,

    I don't have permissions to upload. You might be interested in a post that I submited to a similur forum, http://www.infopathdev.com/forums/thread/20220.aspx 20691. This might help explain what I am working torwards.

    I was successfully able to complete the tutorial at; http://enterprise-solutions.swits.net/infopath2003/article.php?t=programmatically-add-item-sharepoint-2003-calendar-infopath-2003-script&c=infopath2003

    it is sort of what I am trying to do only I want to submit to an issues list not an event to a calendar. But when I modified it to fit my design the button did not submit nor did I get an error that something was wrong.

    My source:

    var root = XDocument.DOM;

     // Retrieve the values for the Action Item
    var PPCEID = root.selectSingleNode("my:myFields/my:PPCEID").text;
    var PPCENumber = root.selectSingleNode("my:myFields/my:PPCENumber").text;
    var Description = root.selectSingleNode("my:myFields/my:Description").text;
    var AssignedTo0 = root.selectSingleNode("my:myFields/my:AssignedTo0").text;
    var Status0 = root.selectSingleNode("my:myFields/my:Status0").text;
    var DueDate = root.selectSingleNode("my:myFields/my:DueDate").text;
    var batch = XDocument.DataObjects["assToCAML"].DOM;

    // Set PPCEID batch.selectSingleNode("/Batch/Method/Field[@Name='PPCEID']").text = PPCEID;
    // Set PPCENumber batch.selectSingleNode("/Batch/Method/Field[@Name='PPCENumber']").text = PPCENumber;
    // Set Description batch.selectSingleNode("/Batch/Method/Field[@Name='Description']").text = Description;
    // Set AssignedTo batch.selectSingleNode("/Batch/Method/Field[@Name='AssignedTo0']").text = AssignedTo0;
    // Set Status batch.selectSingleNode("/Batch/Method/Field[@Name='Status0']").text = Status0;
    // Set DueDate batch.selectSingleNode("/Batch/Method/Field[@Name='DueDate']").text = DueDate;
    // Submit the item details to the web service to update AI List

    XDocument.DataAdapters["Submit"].Submit();

    Sorry for the confusion. Thanks for you patience.

    Jack Eagly
  • 06-14-2007 02:59 PM In reply to

    • jeagly
    • Top 500 Contributor
      Male
    • Joined on 06-05-2007
    • Huntsville
    • Posts 37

    Re: Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

    Okay Matt,

    I got this usefull error, "InfoPath cannot complete this action because of an error in the form's code." Let me know if anything jumps out at you!

    function Submit::OnClick(eventObj)

    {
    var root = XDocument.DOM;
    // Retrieve the values for the calendar item
    var PPCEID = root.selectSingleNode("my:myFields/my:PPCEID").text;
    var PPCENumber = root.selectSingleNode("my:myFields/my:PPCENumber").text;
    var Description = root.selectSingleNode("my:myFields/my:Description").text;
    var AssignedTo0 = root.selectSingleNode("my:myFields/my:AssignedTo").text;
    var Status0 = root.selectSingleNode("my:myFields/my:Status").text;
    var DueDate = root.selectSingleNode("my:myFields/my:DueDate").text;
    var batch = XDocument.DataObjects["EventsCAML"].DOM; //

    Set the location batch.selectSingleNode("/Batch/Method/Field[@Name='PPCEID']").text = PPCEID;
    // Set the location
    batch.selectSingleNode("/Batch/Method/Field[@Name='PPCENumber']").text = PPCENumber;
    // Set the start date
    batch.selectSingleNode("/Batch/Method/Field[@Name='Description']").text = Description;
    // Set the end date
    batch.selectSingleNode("/Batch/Method/Field[@Name='AssignedTo0']").text = AssignedTo;
    // Set the start date
    batch.selectSingleNode("/Batch/Method/Field[@Name='Status0']").text = Status;
    // Set the end date
    batch.selectSingleNode("/Batch/Method/Field[@Name='DueDate']").text = DueDate + "T";
    // Submit the item details to the web service to update the calendar
    XDocument.DataAdapters["Submit"].Submit();
    }

    Jack Eagly
  • 06-14-2007 03:46 PM In reply to

    Re: Is it possible to submit from InfoPath to a List in SharePoint that contains a column type (choice)?

    Hi Jack,

    Did the error give a line number? I don't really have time to debug your code.  My guess is that it's an XPath error.  In general, you should check to see if the selectSingleNode() returns null or not before accessing the .text attribute.  We use a helper function to do this and it returns "" if the node is null.

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.