Two different errors from same template when trying to SubmitToSharePointList - InfoPath Dev
in

InfoPath Dev

Two different errors from same template when trying to SubmitToSharePointList

Last post 02-20-2015 10:41 AM by David Alvarado. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-19-2015 02:48 PM

    Two different errors from same template when trying to SubmitToSharePointList

    Hello,

    I have published an InfoPath template as a browser enabled form and am running into two different errors when trying to submit data to a SharePoint List.


    1. When trying to submit data to a SharePoint List from the office client version of the template, I receive the following error:

    The operation failed because an unexpected error occurred. (Result Code: 0x80020005)

    2. When trying to submit data to a SharePoint List from the browser template, I receive the following error:

    Error occurred adding a new item: Invalid data has been used to update the list item. The field you are trying to update may be read only.



    I have 14 fields mapped to the SharePoint list:

    Form nodes to SharePoint columns:

    - ee_Class (text) to Class (choice)

    - ee_FirstName (text) to FirstName (single line of text)

    - ee_LastName (text) to LastName (single line of text)

    - ee_EEODate (date) to EEODate (date and time)

    - ee_Department (text) to Department (lookup)

    - ee_JobTitle (text) to JobTitle (single line of text)

    - ee_Supervisor (text) to Supervisor (single line of text)

    - ee_Status (text) to Status (lookup)

    - ee_FirstDay (date) to FirstDay (date and time)

    - ee_TempToRegular (text) to TempToRegular (choice)

    - ee_FormsComplete (text) to FormsComplete (choice)

    - ee_IDBadge (text) to IDBadge (choice)

    - ee_BenefitsPortionOnly (text) to BenefitsPortionOnly (choice)

    - ee_RegistrationID (integer) to RegistrationID (Number)



    None of the nodes or SharePoint columns have been marked required.

    I have attached a copy of the template to this post. The form is not 100% complete. I was just testing its submit ability when I came across these errors.

    Any help you can offer is greatly appreciated.

    Thank you,

    --
    David Alvarado
  • 02-19-2015 03:17 PM In reply to

    Re: Two different errors from same template when trying to SubmitToSharePointList

    Hi! You are getting two different errors because in the Filler (preview) we are using web services to add or update the items, and in the browser, we are using the SharePoint Object Model. That said, I'd guess that the issue is going to stem from your lookup columns. Is the text in ee_Department a value that is available when you manually add an item in the list for Department?

    Generally, if we are submitting to a lookup column (or a person or group column) we can submit with a -1 and SharePoint will look things up - this thread is sort of long, but my first post in it talks about this.

    Hilary Stoupa

  • 02-20-2015 09:21 AM In reply to

    Re: Two different errors from same template when trying to SubmitToSharePointList

    Hi Hilary! Thank you for getting back to me so quickly! I read through the thread you provided a link to and attempted to implement one of your suggestions from the thread. I added additional fields to my form that would provide the correct syntax of ID;#Display for the two fields which are submitting to SharePoint look up columns.

    As you recognized from my post/form, the Department and Status fields are look up fields in the SharePoint List which my InfoPath form submits to. In SharePoint, these two fields receive their values from two other SharePoint Lists which contain our current department names and current employee status types. In the InfoPath form, these two fields are drop-down lists and look up their values from external data source connections which are setup to receive data from their respective SharePoint lists.

    The drop-down list properties does not allow me to add the "-1;#" syntax to prefix each drop-down field's value. So, I added two additional fields to the form that would concatenate the proper syntax needed to update the two look up fields in SharePoint. I then updated my mapping to link the new concat fields to the SharePoint look up fields in the List this form submits to.

    I was pleased to see that with these changes the form would in fact submit data without producing any errors! I did encounter another issue unfortunately. Although the form did successfully submit data to the SharePoint List, it was incomplete data. All but the two look up fields in the SharePoint List were populated with the data from the InfoPath form. The Department and Status fields in the SharePoint List were left blank after the submission from the form but again the form did not produce any errors so I'm sure I'm missing something.

    I see that in the other thread you provide an example of the syntax needed based on the ID and Display Name of list item. In the example, the display name contained a space in its name "First Item" but the space was eliminated in the display position of the syntax"FirstItem". Is this also a requirement? The concat fields I added take the display names exactly as they are listed in their SharePoint Lists, spaces and special characters included. Would this prevent the update of the SharePoint look up columns?

    Thank you once again for your help! I really appreciate it.
    --
    David Alvarado
  • 02-20-2015 09:36 AM In reply to

    Re: Two different errors from same template when trying to SubmitToSharePointList

    Hi, David - great job so far, let's see if we can figure out why you don't see data in those fields.

    I looked at your drop downs, and they are both using Title for the value, so that should be the right thing to submit. You shouldn't have to remove any spaces - you want the value you send to the list to be exactly the same as the options available. Can you put the new fields with the concat formula on your form so you can verify the value looks right?

    Another option would be to include the ID column in your data connections to the Status and Department list and submit the actual ID instead of trying to update with the text value. :)

    Hilary Stoupa

  • 02-20-2015 10:41 AM In reply to

    Re: Two different errors from same template when trying to SubmitToSharePointList

    Hi Hilary! That was exactly what I needed to do!

    In the concat fields, I replaced the text in the ID position of the syntax with the ID field from the secondary data connection (filtered for the Title equal to selection from the drop-down list) and voila, the SharePoint List updates with complete data.

    Thank you very much for your help with this problem. You saved me once again. :D
    --
    David Alvarado
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.