web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add Custom Format to a...
Power Automate
Unanswered

Add Custom Format to a Sharepoint Column when creating it through Power Automate

(0) ShareShare
ReportReport
Posted on by

Hey everyone. I'm creating a bit of a complex flow to do some calculations in a Sharepoint list.

 

I'm having a problem when trying to set a custom JSON format in a column I'm creating with an HTTP call. There are no errors if I try to create the column without any formatting. So I think it has to be in the property I'm assigning the style to or the JSON itself (but it works great If I add it manually to the column through Sharepoint).

 

Here is a screenshot of the HTTP call:

Valero_1-1647175239603.png

 

I'll keep trying in the meantime and post any updates. 

 

If you need more information just let me know and I will provide it.

 

Thanks in advance

 

 

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Trying to set a Custom Format to a new Sharepoint Column

    After a bunch of trial an error, I found out the solution. 

     

    The problem here was with the JSON itself. It needs to be as a string, here is the result call:

     

    2022-03-14_11h45_24.png

     

    Spoiler (Highlight to read)
    "{\"$schema\":\"https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json\",\"elmType\":\"div\",\"children\":[{\"elmType\":\"span\",\"txtContent\":\"@currentField\",\"style\":{\"padding-left\":\"8px\",\"white-space\":\"nowrap\"}}],\"attributes\":{\"class\":\"sp-css-backgroundColor-BgCornflowerBlue sp-css-borderTop-CornflowerBlueFont\"},\"style\":{\"padding\":\"0\",\"width\":\"=if(@currentField >= [$Capacity], '100%', (@currentField / [$Capacity]) * 100 + '%')\"}}"
    "{\"$schema\":\"https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json\",\"elmType\":\"div\",\"children\":[{\"elmType\":\"span\",\"txtContent\":\"@currentField\",\"style\":{\"padding-left\":\"8px\",\"white-space\":\"nowrap\"}}],\"attributes\":{\"class\":\"sp-css-backgroundColor-BgCornflowerBlue sp-css-borderTop-CornflowerBlueFont\"},\"style\":{\"padding\":\"0\",\"width\":\"=if(@currentField >= [$Capacity], '100%', (@currentField / [$Capacity]) * 100 + '%')\"}}"
  • gianmasmec Profile Picture
    2 on at
    Re: Trying to set a Custom Format to a new Sharepoint Column

    Great solution. Could you provide an alternative for choice fields?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard