SubmitToSharePointList - line breaks? - InfoPath Dev
in

InfoPath Dev

SubmitToSharePointList - line breaks?

Last post 10-25-2012 02:08 PM by Hilary Stoupa. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 10-24-2012 11:12 AM

    SubmitToSharePointList - line breaks?

    I am very new to qRules and pretty new to Infopath so please forgive my ignorance here.  I just bought qRules after I was able to submit things to a custom list with the trial and decided that would be a huge help for me in the future.

    What I am specifically struggling with right now is populating a RichText column in a SharePoint custom list with a mix of text and field values from my Infopath form.  I can get everyting into the RichText column in the list but I would like to have line breaks included. I tried following the instructions here: http://johnliu.net/blog/2011/4/22/line-break-in-infopath-web-browser-forms.html but that didn't seem to help in my case.  The line breaks didn't make it over to the RichText column in the list. I tried setting the field on the Infopath to plain Text or RichText and neither one seems to populate the list column correctly.  I am populating the form field by setting the default value with the concat function, nut by actually typing in the field.

     I'm happy to provide any more detail that would be helpful. Is this even possible?  Thanks in advance for your time.

  • 10-24-2012 11:16 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    Hi - What is the actual value in the XML that you are submitting? You say you are populating the form field by setting the default value with the concat function?
    Hilary Stoupa

  • 10-24-2012 11:32 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    Hilary Stoupa:
    Hi - What is the actual value in the XML that you are submitting? You say you are populating the form field by setting the default value with the concat function?

     Im not sure what the actual value in the XML is.  The field is called "Details" on the form.  It is set to Data type Rich Text.  The default value is set to the following:  concat("Please process the following form.", @crlf, "Employee Name: ", DisplayName).  Naturally @crlf and DisplayName are field names in the form.  So technically the field isn't on the form but its listed in the field tree, I need its contents submitted to the SharePoint list.  That is all working with the mapping and qRule but I can't seem to get line breaks to show up.

     Hopefully that makes sense.

  • 10-24-2012 11:35 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    Can you save the XML created by your form (or, if it has been submitted to a form library) and attach it to a reply here? Under the Options tab? Then I can open in a text editor and see what the XML value is.
    Hilary Stoupa

  • 10-24-2012 11:51 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    Not sure if this will come through correctly.  I sent you an abbreviated version of the default value before, here is the exact default value from the form:

     concat("Please process the following employee termination.", @crlf, "Employee Name: ", DisplayName, @crlf, "Last day worked will be:  ", LastDayWorked, @crlf, "Form was originally submitted by: ", DisplayName, @crlf, @crlf, "Please update the asset inventory system and whatever else we do for terminations.")

    Below is the XML you asked for from the subsequent form (line breaks appear in the XML -- unfortunately, in the SharePoint list that it is going to there are no line breaks):

    <my:Details>Please process the following employee termination.
    Employee Name: Test User
    Last day worked will be:  2012-10-25
    Form was originally submitted by: Chris Miller

    Please update the asset inventory system and whatever else we do for terminations.</my:Details>

    This is what gets added to the 'Details' column in the list site (all one long string of text):

    Please process the following employee termination. Employee Name: Test User Last day worked will be: 2012-10-25 Form was originally submitted by: Chris Miller Please update the asset inventory system and whatever else we do for terminations.
     
     
    I did confirm that the column in the custom list is set to Multi line (5 lines) of Rich Text. 
     
  • 10-24-2012 11:56 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    I think this is because SharePoint rich text (like IP rich text) will have HTML <br/> for the line breaks - and that the white space characters you are using are getting stripped out... What does your mapping.xml file look like? Have you indicated that the Details field is rich text? I mean, I'm guessing it isn't in the form data source, but I'm wondering if treating it like it is will affect the end result.
    Hilary Stoupa

  • 10-24-2012 12:02 PM In reply to

    Re: SubmitToSharePointList - line breaks?

    I bet thats it!  Below is an exerpt from my mappings file:

       <Mapping>
          <FormField IsRichText="false" IsId="false" IsAttachment="false">my:myFields/my:IT_ServiceRequest/my:Details</FormField>
          <SharePointColumn>SRDetail</SharePointColumn>
        </Mapping>

    Should I change that to RichText="true" and see if that helps?

  • 10-24-2012 12:04 PM In reply to

    Re: SubmitToSharePointList - line breaks?

    I think you should give that a try - see what happens.

    I do know if I map a rich text InfoPath field to a multiple line column in SharePoint, my line breaks are present.

    Hilary Stoupa

  • 10-25-2012 10:00 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    Hilary Stoupa:

    I think you should give that a try - see what happens.

    I do know if I map a rich text InfoPath field to a multiple line column in SharePoint, my line breaks are present.

     I was so optimistic that this would fix it.  I changed the mapping file to treat the 'Details' field as RichText=true and re-added it to the template and it is still not working correctly.  In the XML file, the line breaks are displayed correctly.  Just to troubleshoot, I added the 'Details' field to the form so I can see how the text is displayed on the form in the RichText field and it isn't honoring the line breaks that I've inserted in the default value concat function either.

     I'm guessing that if I added a RichText field on the form and added line breaks with the enter key that they would transfer over.  I am hoping to auto-populate this field by joining together text and other field values automatically though.  Do you think this is possible?

  • 10-25-2012 10:09 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    Well, again, in a rich text field, you'd have the XHTML that defines the line breaks. Add a rich text field to a form and take a look at the XML after you type in some text and you'll see the difference.

    I'm not sure that there is a work around for the approach you are using - you have some XML file with special characters that you are using to add the line breaks, correct?

    Hilary Stoupa

  • 10-25-2012 11:01 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    Hilary Stoupa:

    Well, again, in a rich text field, you'd have the XHTML that defines the line breaks. Add a rich text field to a form and take a look at the XML after you type in some text and you'll see the difference.

    I'm not sure that there is a work around for the approach you are using - you have some XML file with special characters that you are using to add the line breaks, correct?

    Correct, I see the differences you are referring to now. A bunch of div tags that seem to correspond a line break.  Yes, I have a XML file with the following special characters defined:

     <?xml version="1.0" encoding="UTF-8"?>
    <characters
        cr="&#xD;"
        lf="&#xA;"
        crlf="&#xD;&#xA;"
    />

    Back to google to see if I can populate the default value with some other characters to represent a line break I guess. :(

  • 10-25-2012 11:14 AM In reply to

    Re: SubmitToSharePointList - line breaks?

    The thing is - I think even if you set your "break" characters to <br/> or add divs or whatever, when you went to insert these into the field using a formula, InfoPath is going to escape them for you.
    Hilary Stoupa

  • 10-25-2012 01:58 PM In reply to

    Re: SubmitToSharePointList - line breaks?

    Thank you for the help.  I finally got it figured out.  I converted the Infopath form field to plain text.  Then I simply used <BR> tags in the text areas of the concat function and then the RichText column in SharePoint converted them to linebreaks and formatted it correctly for me. I had to manually edit the Xpath in the function for some reason but its working now.  Not that I can imagine anyone would ever needing to do this but here is my function in the default value in the text field of the form in case someone else ever needs to do something similiar:

    concat("Please process the following employee termination.<BR>
    Employee Name: ",../../my:Approvers/my:EmployeeName/pc:Person/pc:DisplayName , "<BR>
    Last day worked will be: ", substring(../../my:TerminationOfEmployment/my:LastDayWorked, 6, 2), "/", substring(../../my:TerminationOfEmployment/my:LastDayWorked, 9, 2), "/", substring(../../my:TerminationOfEmployment/my:LastDayWorked, 1, 4), "<BR>
    Form was originally submitted by:",../../my:Approvers/my:Submitter/pc:Person/pc:DisplayName,  "<BR><BR>

    Please update the asset inventory system and whatever else we do for terminations")

     That produced the desired result of below in the RichText column of the SharePoint list:

    Please process the following employee termination.
    Employee Name: Test User
    Last day worked will be: 10/26/2012
    Form was originally submitted by:Chris Miller

    Please update the asset inventory system and whatever else we do for terminations
     
    Thanks again for the quick responses and helping me along.
  • 10-25-2012 02:08 PM In reply to

    Re: SubmitToSharePointList - line breaks?

    Oh, that is wonderful that it worked for you!!! And thanks so much for posting your resolution - never know, someone else may need it!
    Hilary Stoupa

Page 1 of 1 (14 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.