cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
knishal
Helper IV
Helper IV

Create a news when an item is created Question

Hi I have a question about this post you created. https://powerusers.microsoft.com/t5/Building-Flows/Create-a-news-post-when-a-list-item-is-created/m-...

 

 

l follow the instruction in that post and was successful, however at the last send HTTP action whenever I add the Text Properties from the when a new item is created, I am getting this error:

 

knishal_0-1664452964748.png

 

 

When a new item is created: I am adding the Text on and thats where the error is coming from. If I add title/name the flow runs with no errror:

 

knishal_1-1664452964746.png

 

 

Would you be able to assist?

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @knishal,

 

Your Title is empty, you used Title/Name field for that before, right? Can you please add a Title in the last part of your json?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

10 REPLIES 10
Expiscornovus
Super User
Super User

Hi @knishal,

 

Have you added the Text field within the innerHTML property? Can you also share a screenshot of the configuration of that Send an HTTP request action which uses the SavePageAsDraft method?

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus  I think the issue is, its getting the text field as an HTML. When I add the text field I am getting the error only, it started a timer on the work flow then it fails after 20 minutes.

 

here is the code:

 

knishal_1-1664466300286.png

 

The flow runs fine when I remove the text field.

 

I think since the text filed is a multiple line of text field in sharepoint, there has to be a compose method to remove the HTML tags because this is how its seeing the text field:

 

This is the output for  when an item is created.

</div>","Text2":"<div class=\"ExternalClass747E7CCDCE8A42DEA57125DABC98288E\"><p>​​test8​<br></p></div>

 

If there is a way it can remove the the html tags, i think then it will work. The test 8 is the text that needs to be extracted.

Expiscornovus
Super User
Super User

Hi @knishal,

 

In that case try an HTML to text action. And use the output of that in your Send an HTTP request action.

 

htmltotextaction.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


knishal
Helper IV
Helper IV

Thank you @Expiscornovus  I tried that but its giving me the same issue: 

knishal_2-1664467212213.png

 

knishal_3-1664467254233.png

 

knishal
Helper IV
Helper IV

This is the raw out from the HTML To Text:

{
    "host": {
        "connectionReferenceName": "shared_conversionservice",
        "operationId": "HtmlToText"
    },
    "parameters": {
        "Content": "<p><div class=\"ExternalClassF3736BF7A7E74453854FAF6D68CD89E0\"><p>​test8<br></p></div></p>"
    }
}
Expiscornovus
Super User
Super User

Hi @knishal,

 

That looks like the input instead of the output, to be honest. What is in the raw outputs?

 

rawoutputs_htmltotext.png

 

When I use your html I am getting this:

slashn.PNG

 

It looks like it is adding new line characters. We can remove them by using a replace.

 

Can you use this together with the HTML output?

replace(body('Html_to_text'), decodeuricomponent('%0A'), '')

 

replacefunction.png

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Yes i took a look, I am getting the same output as well. I tried with your 

replace(body('Html_to_text'), decodeuricomponent('%0A'), '')

& I am getting the same error:

knishal_0-1664480960675.png

 

knishal_1-1664480997642.png

 

 

Expiscornovus
Super User
Super User

Hi @knishal,

 

Your Title is empty, you used Title/Name field for that before, right? Can you please add a Title in the last part of your json?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Wow. That works, Thank you so much @Expiscornovus . 

 

Now I need to add a picture but it starts the timer when I did, Where do I add the picture in the json?

knishal_0-1664539396048.png

 

I am getting the picture from when an item is created:

knishal_1-1664539468228.png

 

Also is it possible to use a template or retain this format:

knishal_2-1664539638824.png

 

I have a profile banner image url on the destination site:

knishal_0-1664541539705.png

Whenever a post is created it, display the image and the title on the home page:

knishal_1-1664541604282.png

 Its currently not displaying any image. Do i get a get the image and store it somewhere or how can I do this? @Expiscornovus 

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,058)