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 / Created item on Lists-...
Power Automate
Unanswered

Created item on Lists- will fill a choice column

(0) ShareShare
ReportReport
Posted on by 14

Hello, I am new at this. Please help me if you can. 

 

The goal: When a new item is added to Lists (There is already an automation- with the new items on Lists are created by submitted forms) a Choice is automatically selected based on what is in Column "Country". 

 

If Column "Country" Has one of the following: 

-DE

-IT

-UK

-FR

Then Column "Status" will have: "Input Required"

 

If Column "Country" has a different variable than above, Column "Status" will have: "N/A" 

 

Kind Regards,

Holly 

 

Categories:
I have the same question (0)
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at
    Re: Created item on Lists- will fill a choice column

    @HollyNewell  so you want to set value of column status based on country column value when new item is created in list? If yes, then create a flow with trigger when item is created, then add condition action to check value of country column, and in the yes and no branch of condition add update item action to update value of status column.

  • eliotcole Profile Picture
    4,363 Moderator on at
    Re: Created item on Lists- will fill a choice column

    Hi, @HollyNewell , I guess my main question is:

    Do you intend to use the "Status" column for anything else?

     

    I ask this because ( purely based on the above ) I see a binary situation there. It's either that input is needed, or not.

     

    Purely SharePoint Solution

    Columns

    I have made three columns:

    Single Line of Text - Country

    inputRequired - Calculated Yes/No - This uses a formula to define if it is Yes or No.

    Status - Calculated Single Line of Text - This could use the same formula as inputRequired, but I decided to base it on that field for variety.

     

    Formulas

    For the 'Yes/No' calculated column 'inputRequired' I used this formula:

    =OR(EXACT(Country,"-DE"),EXACT(Country,"-IT"),EXACT(Country,"-UK"),EXACT(Country,"-FR"))

    I used this code for the formatting:

    {"elmType":"div","style":{"box-sizing":"border-box","padding":"0 2px"},"attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField",true]},"sp-css-backgroundColor-blockingBackground50",{"operator":":","operands":[{"operator":"==","operands":["@currentField",false]},"sp-css-backgroundColor-successBackground50",""]}]}},"children":[{"elmType":"span","style":{"line-height":"16px","height":"14px"},"attributes":{"iconName":{"operator":":","operands":[{"operator":"==","operands":["@currentField",true]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",false]},"",""]}]}}},{"elmType":"span","style":{"overflow":"hidden","text-overflow":"ellipsis","padding":"0 3px"},"txtContent":"@currentField.displayValue","attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField",true]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",false]},"",""]}]}}}],"templateId":"BgColorBoolean"}

     

    For , the Single Line of Text calculated column I used this formula:

    =IF(EXACT(requiresInput,TRUE),"Input Required","n/a")

    I used this code for the formatting:

    {"elmType":"div","style":{"flex-wrap":"wrap","display":"flex"},"children":[{"elmType":"div","style":{"box-sizing":"border-box","padding":"4px 8px 5px 8px","display":"flex","border-radius":"16px","height":"24px","align-items":"center","white-space":"nowrap","overflow":"hidden","margin":"4px 4px 4px 4px"},"attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField","Input Required"]},"sp-css-backgroundColor-blockingBackground50",{"operator":":","operands":[{"operator":"==","operands":["@currentField","n/a"]},"sp-css-backgroundColor-successBackground50",{"operator":":","operands":[{"operator":"==","operands":["@currentField",""]},"","sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralSecondary"]}]}]}},"children":[{"elmType":"span","style":{"line-height":"16px","height":"14px"},"attributes":{"iconName":{"operator":":","operands":[{"operator":"==","operands":["@currentField","Input Required"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField","n/a"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",""]},"",""]}]}]}}},{"elmType":"span","style":{"overflow":"hidden","text-overflow":"ellipsis","padding":"0 3px"},"txtContent":"@currentField","attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField","Input Required"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField","n/a"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",""]},"",""]}]}]}}}]}],"templateId":"BgColorChoicePill"}

     

    I didn't make those formatting codes myself, for the text field I created a separate choice field with the exact same values it calculates, then copied the automated formatting that the modern SharePoint site does for it. For the Yes/No, you can edit it by right clicking the column when looking at the list.

     

    Power Automate Solution

    If I'm reading this correctly, you already have a flow that is handling this, you can go one of two ways:

    1. Full Flow Logic - Create a country array variable, and a status variable, and set the status variable on that.
      • Array variable - I'll call mine countryArrVAR - This contains a list of the texts to look out for.
      • String variablestatusVAR - Is changed dependent on their presence in the 'Country' column.
      • Condition action - A four pronged OR condition, where each prong will be to see if the Country column value equals the text above.
    2. Expression Logic - Use a one or two expressions to set a boolean then decide if the Status text will be "Input Required" or "N/A"

     

    Full flow logic is the easiest to understand because you can see it all visually, but I'll flesh both of these out with a couple of examples in a bit, but hopefully I've plotted them out enough for you to work out the rest.

     

    If you respond, I'll reply again, otherwise I'll edit more into this reply myself. 🙂

  • eliotcole Profile Picture
    4,363 Moderator on at
    Re: Created item on Lists- will fill a choice column

    Hi, @HollyNewell , I guess my main question is:

    Do you intend to use the "Status" column for anything else?

     

    I ask this because ( purely based on the above ) I see a binary situation there. It's either that input is needed, or not.

     

    Purely SharePoint Solution

    Columns

    I have made three columns:

    1. Single Line of Text - Country
    2. inputRequired - Calculated Yes/No - This uses a formula to define if it is Yes or No.
    3. Status - Calculated Single Line of Text - This could use the same formula as inputRequired, but I decided to base it on that field for variety.

     

    Formulas

    For the 'Yes/No' calculated column 'inputRequired' I used this formula:

    =OR(EXACT(Country,"-DE"),EXACT(Country,"-IT"),EXACT(Country,"-UK"),EXACT(Country,"-FR"))

    I used this code for the formatting:

    {"elmType":"div","style":{"box-sizing":"border-box","padding":"0 2px"},"attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField",true]},"sp-css-backgroundColor-blockingBackground50",{"operator":":","operands":[{"operator":"==","operands":["@currentField",false]},"sp-css-backgroundColor-successBackground50",""]}]}},"children":[{"elmType":"span","style":{"line-height":"16px","height":"14px"},"attributes":{"iconName":{"operator":":","operands":[{"operator":"==","operands":["@currentField",true]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",false]},"",""]}]}}},{"elmType":"span","style":{"overflow":"hidden","text-overflow":"ellipsis","padding":"0 3px"},"txtContent":"@currentField.displayValue","attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField",true]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",false]},"",""]}]}}}],"templateId":"BgColorBoolean"}

     

    For , the Single Line of Text calculated column I used this formula:

    =IF(EXACT(requiresInput,TRUE),"Input Required","n/a")

    I used this code for the formatting:

    {"elmType":"div","style":{"flex-wrap":"wrap","display":"flex"},"children":[{"elmType":"div","style":{"box-sizing":"border-box","padding":"4px 8px 5px 8px","display":"flex","border-radius":"16px","height":"24px","align-items":"center","white-space":"nowrap","overflow":"hidden","margin":"4px 4px 4px 4px"},"attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField","Input Required"]},"sp-css-backgroundColor-blockingBackground50",{"operator":":","operands":[{"operator":"==","operands":["@currentField","n/a"]},"sp-css-backgroundColor-successBackground50",{"operator":":","operands":[{"operator":"==","operands":["@currentField",""]},"","sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralSecondary"]}]}]}},"children":[{"elmType":"span","style":{"line-height":"16px","height":"14px"},"attributes":{"iconName":{"operator":":","operands":[{"operator":"==","operands":["@currentField","Input Required"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField","n/a"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",""]},"",""]}]}]}}},{"elmType":"span","style":{"overflow":"hidden","text-overflow":"ellipsis","padding":"0 3px"},"txtContent":"@currentField","attributes":{"class":{"operator":":","operands":[{"operator":"==","operands":["@currentField","Input Required"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField","n/a"]},"",{"operator":":","operands":[{"operator":"==","operands":["@currentField",""]},"",""]}]}]}}}]}],"templateId":"BgColorChoicePill"}

     

    I didn't make those formatting codes myself, for the text field I created a separate choice field with the exact same values it calculates, then copied the automated formatting that the modern SharePoint site does for it. For the Yes/No, you can edit it by right clicking the column when looking at the list.

     

    Power Automate Solution

    If I'm reading this correctly, you already have a flow that is handling this, you can go one of two ways:

    1. Full Flow Logic - Create a country array variable, and a status variable, and set the status variable on that.
      • Array variable - I'll call mine countryArrVAR - This contains a list of the texts to look out for.
      • String variable statusVAR - Is changed dependent on their presence in the 'Country' column.
      • Condition action - Here you can either use:
        • A four pronged OR condition, with a country in each
          or
        • Use the countryArrVAR in a contains condition with the Country field on the right
    2. Expression Logic - Use a one or two expressions to set a boolean then decide if the Status text will be "Input Required" or "N/A"

    Flow

    I used the array option in the condition:

    flowversion.jpg

     

     

    Expression

     

    It's actually a pretty simple expression, only using two functions:

    if(contains('-DE -IT -UK -FR', triggerBody()['text']), 'Input Required', 'n/a')
    • The contains() function searches the first string for any instances of the second string (I used a button trigger to test).
    • That returns a true value on a match that powers the true branch of the if() function.

    expression.jpg

     

    ----

     

    Full flow logic is the easiest to understand because you can see it all visually, but the expression is definitely simpler ... however the pure SharePoint version eliminates any need at all. However you can't then power further actions in your existing flow with those updates, unless you retrieve the item at the start of the flow.

     

    eliotcole_0-1620774498678.png

     

  • eliotcole Profile Picture
    4,363 Moderator on at
    Re: Created item on Lists- will fill a choice column

    DELETE

     

     

  • eliotcole Profile Picture
    4,363 Moderator on at
    Re: Created item on Lists- will fill a choice column

    DELETE

  • HollyNewell Profile Picture
    14 on at
    Re: Created item on Lists- will fill a choice column

     

    Thank you for your reply, 

    Maybe I am too new at this, as much of what you say does not make sense to me. 

     

    The sharepoint solution doesnt make sense to me- As there is two columns in my situation, not three. 

     

    I started to do your full flow logic solution, this makes more sense to me, but it is not working. 

    I cannot find and select the Country column on my List page. 

     

    HollyNewell_0-1621346309225.png

     

     

     

  • HollyNewell Profile Picture
    14 on at
    Re: Created item on Lists- will fill a choice column

    This is what happend when I tried your Expression: 

    The Flow failed. 

     

    HollyNewell_0-1621424250836.png

    These are all the column I have. 

    HollyNewell_2-1621426553550.png

     

     when "DE, FR, IT, UK" are in the "Country" Column. the "Backoffice STATUS" to say "Input required" 

     

    This Backoffice status will eventually be changed manually to "Complete" - Will this cause a problem? 

  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at
    Re: Created item on Lists- will fill a choice column

    @HollyNewell  what is the name of your country column? You will need to use internal name of your country column instead of 'text' in the below expression 

    if(contains('-DE -IT -UK -FR', triggerBody()['text']), 'Input Required', 'n/a')
    

    to get internal name of your column "Go to your List Settings, then click on the specific column, then look at the browser URL, take the name what appears after the Field=

    E.g. http://test.sharepoint.com/sites/test/_layouts/15/FldEditEx.aspx?List=%7BA4E78CC7-F74F-4733-832A-099D945908A8%7D&Field=Link is my URL when I click on Link field in List Settings, here my internal field name is Link, which I will use in the expression."

  • HollyNewell Profile Picture
    14 on at
    Re: Created item on Lists- will fill a choice column

    Hello, I have added the URL of the Country column. but it is saying it does not exist. I have put the full URL as well as like: "List=%7BD192496B%2D315E%2D4959%2D8464%2D37C4538FE62A%7D&Field=Country"

  • HollyNewell Profile Picture
    14 on at
    Re: Created item on Lists- will fill a choice column

    I have solved this by just putting "Country" in there, there is no need for the URL. 

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