cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HollyNewell
Frequent Visitor

Created item on Lists- will fill a choice column

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 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@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-099... 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."

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

12 REPLIES 12
annajhaveri
Super User
Super User

@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.

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.
eliotcole
Continued Contributor
Continued Contributor

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
Continued Contributor
Continued Contributor

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
Continued Contributor
Continued Contributor

DELETE

 

 

eliotcole
Continued Contributor
Continued Contributor

DELETE

 

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

 

 

 

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? 

@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-099... 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."

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

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"

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

This is now working. however, if there is a different country (other than DE IT FR UK)  in the country column I would like it to show "N/A". This expression i used is only bringing up when input is required and I need it to do both please

eliotcole
Continued Contributor
Continued Contributor

I'll try to catch up with all this tomorrow, @HollyNewell , in the meantime, I'm glad you have some functionality. 🙂

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,175)