Forum Discussion

GamerzKris's avatar
GamerzKris
Brass Contributor
May 04, 2021
Solved

Use Flow to copy selected item from one list to another list based on a dropdown selection

Hello,   I am relatively new to Power Automate Flows, and I was wondering if anyone has figured out how to copy/move a list item from one MS List to another MS List using a flow, but instead of jus...
  • RobElliott's avatar
    May 05, 2021

    GamerzKris you can do this quite easily using a variation of my example in the images below which copies an airport from a main list of all worldwide airports into a list for a specific country which the user selects when the flow runs. As with your flow the trigger is "For a selected item":

     

     

    Next you need to initialize a variable to hold the option selected.

     

    Next, add a get item action to get the relevant item from the list.

     

    Next, add a type of condition called a Switch - you can have up to 27 separate cases, so it's "if the country in the varCountryList variable is Australia then do some actions, if it's New Zealand then do some actions, if it's United Kingdom then do some actions, if it's none of those then do some actions (or not)". In your scenario you would probably only need Q1, Q2, Q3 and Q4.

     

    We want to copy the airport to the appropriate country list so we add a Create item action:

    If you wanted to move the item instead of copying it you would then add a Delete item action to delete it from the master list of airports. 

     

    Now to trigger it you just need a JSON-formatted button your list:

     

    The JSON for that is as follows and you will need to change the txtContent line to whatever text you want in your button, and also change the ActionParams line to include the id of your flow:

     

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "button",
      "txtContent": "Copy to Country List",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "{\"id\": \"c9393a9a-5f4f-48c3-802d-6938ba8cde4b\"}"
      },
      "style": {
        "background-color": "#f14717",
        "color": "#ffffff",
        "outline": "transparent",
        "border-width": "1px",
        "border-style": "solid",
        "border-radius": "5px 25px",
        "border-color": "transparent",
        "cursor": "pointer",
        "font-size": "12px"
      }
    }

     

     

     I selected Abingdon Downs Airport in Australia, the flow ran and it copied it over to the Airports Australia list:

     

    So adapt that to your scenario and come back with any questions.

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

     

Resources