Workflow to Update Document - Formatting Question

  • 22 August 2016
  • 7 replies
  • 2 views

Badge +3

Hi, I'm having trouble getting my format in a Word Document correct. the basic workflow does this

1) read a SharePoint list of users into a collection variable.

2) Read the collection variable and gather First Name, Last Name, etc

3) Build a Word Document to create a contact list in a table

190161_pastedImage_0.png

190162_pastedImage_1.png

We then have created a document with Plain Text Content Controls, which the "Update Document" Step is populating.

The problem we are having is that the Content Control is being populated as a single line, instead of putting each entry on a new line. Screenshot Below

190170_pastedImage_3.png

We have tried the following to troubleshoot:

1) logged the string output in the Workflow History. it output shows each entry is correctly on a new line (I.E the issue is not the "Build String" step). This is how we would like to see the output in the MS Word Document.

190169_pastedImage_2.png

2) in MS Word, changed to a Real Text Content Control. This yielded funny results

Ā Ā Ā Ā Ā Ā Ā Ā Ā  I) we then got each result on a new line as required

Ā Ā Ā Ā Ā Ā Ā Ā Ā  II) However, we then seem to get an additional line, which is all of the same results repeated on a single line of text again. I have no idea where or why this iaĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā  happening

190171_pastedImage_4.png

3) In the Plain Text Content Control Properties, we enabled the box to allow Carriage Returns.

Ā Ā Ā Ā Ā Ā Ā Ā Ā  I) we get exactly the same behavior as the Real Text Control above

What am I doing wrong?

Thanks

Carl


7 replies

Userlevel 6
Badge +13

What does your Build String action setting look like?

Badge +3

Here you go. I've included the Query, the Collection and the Build String. The Log History shows what the final string is, however, the MS Word Document seems to contain "extra" when I use that same string.

190186_pastedImage_0.png

190187_pastedImage_1.png

190188_pastedImage_2.png

the variable which I'm logging in the history list above is being used to update the document Control. Totally confused as to why the history output differs from the data showing in the document (screenshots in original post)

190190_pastedImage_0.pngA

Thanks in Advance

Userlevel 6
Badge +13

I think, from looking at this, that your build string is just appending your new users onto the existing variable before the Update happens, so I think your logic needs a little reworking.

So here is the order of things that are happening

Query stored in Collection

For Each

User 1 First Name etc

Build String = "User 1"

For Each

User 2 First Name etc

Build String = "User 1User2"

For Each

User 3 First Name etc

BuildĀ  String = "User 1User 2User 3"

Update Document

Does this make sense?

In the Build String, you should be able to use the {Common:NewLine} command.

Try that

Badge +3

Hi Ryan,

I also did try the "new line" command within the string. the same result is occurring

You are right - My string is building on itself. However, I have put the two commands on separate lines, and verified via the Workflow Log that it is actually putting it on separate lines. check it out

Workflow log:

190191_pastedImage_0.png

this same variable is then inserted into a rich text control in MS Word. here is the result

190192_pastedImage_1.png

I'm at the verge of giving up on this, I just cant understand where or why it is getting the repeated data from, especially since its not in the output to the workflow log

Thanks

Carl

Badge +10

Hi Carl,

You can try one more thing, the collection variable is having data in an array. try updating the content control directly with collection variable ( I haven't tried it , just a suggestion), if it works it should come line by line automatically.

Badge +3

Hi, thanks for the suggestion. I did try this. the array format is a flat list with each value being separated by a ;

the output of this will not be in list format

Badge +2

I also have this problems....

Reply