cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Help with a simple Workflow

Hi!,

I hope can help me.

I have made a simple wokflow, where, when an item is created in a sharepoint, it obtains that item and different conditions are raised with a (Switch), this, to apply an "Adaptive Card" that works as a Chat Bot in Teams.

This works perfect, but, in this "adaptive card" I want to put a direct link so that the person who receives it can open the file.

 

When putting a "Get Attachments" action, this works perfectly as long as there is an attachment, but, in case there is no attachment, the flow ends before sending the "adaptive card". 

I need to know if there is a way that, even if there is no attached file, the flow continues to execute.

 

Thanks you!

Emilealonso_0-1646058559514.png

help.PNG

 
 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
ArchitectMadhan
Super User
Super User

Hi @Anonymous ,

You can get the number of attachments and store it in a variable before the step of Switch Condition check statement. Then the variable value you can make use in the Switch A function block within a if condition. The below link might be useful for you to get the count of attachments from a SharePoint List Item.

https://powerusers.microsoft.com/t5/Building-Flows/Count-the-number-of-attachments-in-a-SharePoint-list-item/td-p/392752

 

Please accept it as a solution and give thumbs up, if it works for you.

- Architect Madhan

Please click the "Accept as Solution" button and give thumbs up, if it is helpful to you.

View solution in original post

7 REPLIES 7
ArchitectMadhan
Super User
Super User

Hi @Anonymous ,

Please let me know what value you are having in the Switch condition, is it anything related to attachment?, If yes, then before the Switch statement you need set a value for a variable and then the variable value has to be compared in the Switch statement, For Items with attachment you need to have separate steps and for items without attachment you need to have separate steps.

 

Please accept it as a solution and give thumbs up, if it works for you.

 

- Architect Madhan

Please click the "Accept as Solution" button and give thumbs up, if it is helpful to you.
Anonymous
Not applicable

Hi @ArchitectMadhan 

Thanks for your answer. In the switch condition, there is nothing related to the condition because it is optional for those who create the form with attach files. The problem would be when I want to use the "Adaptive card" where, a part of this, is that, by pressing a button on it, this person can download or access the attached document.

That is why, within the "Switch condition" I have applied different "Equals to". For example, I have 3 options (A, B and C). if the person selects A, you need to extract the attachment, then send the "Adaptive Card" and finally update the item. This works perfectly only if the person attaches a file.

But I need it to work even if the person doesn't attach a file.

 

I hope I have expressed myself well. I'll look forward for your answer.

 

Regards!

Hi @Anonymous ,

From where the Value A comes from ? why it is in the Switch statement? When there is no attachments How does the Switch Statement knows it? If only the Switch condition is not A then it will not create the Adaptive Card and terminate.

 

Please accept it as a solution and give thumbs up, if it works for you.

- Architect Madhan

Please click the "Accept as Solution" button and give thumbs up, if it is helpful to you.
Anonymous
Not applicable

Hi @ArchitectMadhan 

The value of A comes from a selection option made in sharepoint. For each of the options, we work with different people. What I did was that, for each selection, a different workflow was started at the root of the same approver. That is why A, B and C will be independent in each Switch declaration. 

 

According to what it indicates about the attachments, it is what I am missing, since I have applied a Get Attachments but I need to condition that the flow starts even if there is no attachment.

 
 
 
 
 
 
 
 
 
 
 
ArchitectMadhan
Super User
Super User

Hi @Anonymous ,

You can get the number of attachments and store it in a variable before the step of Switch Condition check statement. Then the variable value you can make use in the Switch A function block within a if condition. The below link might be useful for you to get the count of attachments from a SharePoint List Item.

https://powerusers.microsoft.com/t5/Building-Flows/Count-the-number-of-attachments-in-a-SharePoint-list-item/td-p/392752

 

Please accept it as a solution and give thumbs up, if it works for you.

- Architect Madhan

Please click the "Accept as Solution" button and give thumbs up, if it is helpful to you.
Anonymous
Not applicable

Hi @ArchitectMadhan 

It worked, but the last problem keeps coming up. 

When I want to extract the url of the attached document, in my "addaptive card" I use the dynamic content "AbsoluteUri" and, when I attach a document, it works perfectly, but when not, the workflow continues to finish before running the addaptive card .

Anonymous
Not applicable

 

I use an Expression "body('Card1')?(['data']?['IDApprovalDecsion']" to update the status of my progress but, It doesn't work since I don't know how to connect not only an apply to each, but also the "Card1" action. If in the expression change "Card1" to "Apply to each 2", the flow works but the status doesn't change.

help2.PNG

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,864)