Best Practices

 View Only

Ian's Insights Ep. 7 - Power Automate & Multi-select Questions

  • 1.  Ian's Insights Ep. 7 - Power Automate & Multi-select Questions

    Posted 04-07-2022 10:00
    Edited by Pat Cooney 02-06-2024 11:37

    I have been on the Power Automate kick lately and it's been a very interesting journey so far to find all the different ways that Power Automate can help augment ProntoForms!! This one was inspired (as they mostly are) by a problem that was brought up to us when building out a form and destinations for a customer.

    There are times when you might need to write to a List but also use that same list as a data source for your forms. When writing multiselect data into a MS List (or any other destination) ProntoForms will save it differently then how we would need it formatted so that you can use it for a data source. This will keep the original data intact and push the newly formatted values into a new column.

    A destination will write a multiselect answer like this: [Option 1, Option 2, Option3]

    But a data source needs it formatted differently (with new lines separating the values):
    Option 1
    Option 2
    Option 3

    We can use Power Automate to format the data how we need in order to use it as a data source in the future.

    The trigger we will use is the “When an item is created”, point this to your Site and List where ProntoForms is writing data to. Next is take the string that we write to the List and replace the commas with new lines. For this, we will use the Compose action for our next step:

    1. Add in the Compose action and move to the Expression tab.
      Start typing out replace( and then move back over to the “Dynamic Content” tab to add in the appropriate column from the List. (This is whatever column you have ProntoForms writing the Multiselect data to)
    2. The full expression is below. After choosing the correct column from the trigger, you will add in the rest of the formula. Please note that there is a new line on the end of the first line.

      The replace function works like this:
      replace([where to look to replace],[what is being replaced],[what are you replacing with])
      So we are taking the output from the trigger, looking for ‘, ’ (note the space after the comma) and replacing with a new line.
    replace(triggerOutputs()?['body/Multiselect'],', ','
    ')
    1. Next we need to remove the [ ] from the start and end of the string. We will use the Initialize variable action for this step.
      Name: Multiselect
      Type: String
      Value: same as below but replacing the ‘outputs(’Compose’)‘ with the dynamic content in your flow.
    substring(outputs('Compose'),1,sub(length(outputs('Compose')),2))
    1. Next we will need to add in a Condition Control. When only 1 option is selected in a Multiselect, we do not wrap it in [ ] so we need to account for that.
      In the Condition, you will specify the Multiselect Variable that was created starts with [

    image.png

    1. Both the Yes and No conditions will use the same action type, we will just pass different values.

      If YES, we will update the new row with the Multiselect options that we formatted.

    image.pngIf NO, we will update the new row with the same value as was originally written
    image.pngFULL FLOW SCREENSHOTS

    image.pngimage.png


    #SharePoint #PowerAutomate #TechTalkImplementation
    ------------------------------
    Ian Chamberlain
    Implementation Specialist
    ProntoForms
    ------------------------------
    ​​



Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use