cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gaiarsa
Level: Powered On

Word Online Connector (Object reference not set to an instance of an object)

Hello,

I'm trying to create a Word File by using the "Populate a Microsoft Word Template" action from Word Online (Business) Connector. After sucessfuly creating the template and making it recognizable by the Flow action, I tested it and received the following error: 

Object reference not set to an instance of an object
I've tried making the template file reside both in OneDrive for Business and Sharepoint Online, but had no success.
 
I'm populating the fields of the Word Doc using a Sharepoint List with the trigger "When a new item is created". Bellow is a screenshot of the Flow and the Error.

Flow.PNG

 

Error1.PNG

 

Error code says:

{
"error": {
"code": 500,
"source": "flow-apim-msmanaged-na-northcentralus-01.azure-apim.net",
"clientRequestId": "df34166a-2586-4d34-bf47-0de5794ab8d2",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "Object reference not set to an instance of an object.\r\nclientRequestId: df34166a-2586-4d34-bf47-0de5794ab8d2",
"source": "wordonlinebusiness-eus.azconn-eus-01.p.azurewebsites.net"
}
}
}
Any Ideas?

Best Regards,

Pedro

 

1 ACCEPTED SOLUTION

Accepted Solutions
Gaiarsa
Level: Powered On

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt thank you! Your solution worked perfectly. Just adding a little bit for clarification: you must still save the document as a .docx document, not as an .docm (Macro-enabled document).
8 REPLIES 8

Re: Word Online Connector (Object reference not set to an instance of an object)

@Gaiarsa,

 

I wrote a blog overview of the Word Online connectors. Check it out here: https://www.dmcinfo.com/latest-thinking/blog/id/9838/overview-of-microsoft-flows-new-word-online-con...

 

Please give kudos and mark as the solution if it works!

Thanks,


Dan

Gaiarsa
Level: Powered On

Re: Word Online Connector (Object reference not set to an instance of an object)

Hi @danmitchell36 ,

Unfortunately, your link is down for me. I can't seem to access it.

 

Edit: I have followed exactly the steps you outlined and it still does not work. Do you have any other tips?



Best Regards,


Pedro

NickDewitt
Level 8

Re: Word Online Connector (Object reference not set to an instance of an object)

@Dana I don't think you actually read his question, as your blog mentions nothing about the issue he is having.

 

We are also having the same issue with a word document, flow refuses to process the document template with an internal error of "Object reference not set to an instance of an object".

 

+1 to OP for a well written example of the problem.

Dana
Level: Power Up

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt  I think you were not talking to me as I have not posted anything.  Could you have perhaps been talking to 'Dan' ?

NickDewitt
Level 8

Re: Word Online Connector (Object reference not set to an instance of an object)

Ah yeah sorry @Dana it offered @danmitchell36 and autocompleted to you!

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt,

 

I have used the Microsoft Word connectors on a number of projects and have never seen that issue before. While my post didn't address his issue directly I hoped that if he followed the instructions in the blog post he would be able to resolve the issue. 

 

NickDewitt
Level 8

Re: Word Online Connector (Object reference not set to an instance of an object)

@Gaiarsa I managed to fix this problem by deleting and re-inserting all content controls as plain-text (you can only utilise plain-text, combo and dropdown with this connector currently).

 

The document I am working on came from a 3rd party courier with a lot of content controls already inserted, we want to populate this document with data that we have in sharepoint etc.

 

Rather than manually removing and re-inserting all of the content controls, I wrote some vba to do it for me. Insert that into a module in the word vba editor and run it (F5), and you should no longer get this error. This obviously means the error was related to one or more of the content controls that were inserted (although I had already forced all to plain text before re-inserting and that didnt fix it).

 

 

Sub CleanseControls()

    Dim existingControls As New Collection
    Dim cc As ContentControl
    Dim newcc As ContentControl
    
    For Each cc In ActiveDocument.ContentControls
        existingControls.Add cc
    Next cc
    
    For Each cc In existingControls
Dim tag As String: tag = cc.tag Dim title As String: title = cc.title cc.Range.Select cc.Delete Set newcc = ActiveDocument.ContentControls.Add(wdContentControlText) newcc.title = title newcc.tag = tag
Next cc End Sub

 

Gaiarsa
Level: Powered On

Re: Word Online Connector (Object reference not set to an instance of an object)

@NickDewitt thank you! Your solution worked perfectly. Just adding a little bit for clarification: you must still save the document as a .docx document, not as an .docm (Macro-enabled document).

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 504 members 4,790 guests
Please welcome our newest community members: