Question: If we are having a condition like "If status equal approved and ( modifiedby equals 'User1' OR modifiedby equals 'User2')" how to implement this condition in flow.
I have tried AND / OR condition like below:
@or(
equals(body('Update_item')?['Editor']?['DisplayName'], 'Kumawat, Chandrashekhar'),
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName'])
)
@AND(
equals(body('Update_item')?['Editor']?['DisplayName'], 'Kumawat, Chandrashekhar'),
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName'])
)
and both this works fine.
But i want to use OR condition inside AND like below:
@and(
equals(body('Update_item')?['Editor']?['DisplayName'], 'Kumawat, Chandrashekhar [AUTOSOL/PSS/PUNE]'),
@or(
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName']),
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName'])
)
) // this does not work. please suggest
Solved! Go to Solution.
Hi @Anonymous,
Please modify the formula as below:
@and(
equals(body('Update_item')?['Editor']?['DisplayName'], 'Kumawat, Chandrashekhar [AUTOSOL/PSS/PUNE]'),
or(
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName']),
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName'])
)
)
There is no need to add another "@" ahead of the or function.
Removing it should make the formula work.
Regards,
Michael
Hi @Anonymous,
Please modify the formula as below:
@and(
equals(body('Update_item')?['Editor']?['DisplayName'], 'Kumawat, Chandrashekhar [AUTOSOL/PSS/PUNE]'),
or(
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName']),
equals(body('Update_item')?['Editor']?['DisplayName'], body('Update_item')?['Author']?['DisplayName'])
)
)
There is no need to add another "@" ahead of the or function.
Removing it should make the formula work.
Regards,
Michael
Than you Michael . That worked great!! Thanks a lot!!
Hi,
i have a date column in sharepoint list i need to send a mail before 7 days, i am using below formula it is giving error. could you please help me.
@and(less(items('Apply_to_each')?['Sp_x00e4_testens_x0020_zu_x0020_'], addDays(utcNow(), 8)),
(greater(items('Apply_to_each')?['Sp_x00e4_testens_x0020_zu_x0020_'], addDays(utcNow(), 6))
)
i have tried with equal also, it is not comparing.
@equals(items('Apply_to_each')?['Sp_x00e4_testens_x0020_zu_x0020_'], addDays(utcNow(), 3))
Hi Satya,
You can use something like this:
use this:
@equals(formatDateTime(item()?['Sp_x00e4_testens_x0020_zu_x0020_'], 'MM/dd/yyyy'), formatDateTime(addDays(utcNow(), 7), 'MM/dd/yyyy'))
instead of :
@equals(items('Apply_to_each')?['Sp_x00e4_testens_x0020_zu_x0020_'], addDays(utcNow(), 3))
Please refer below link for more detailed approach:
FLOW TO SEND EMAIL WHEN DATE APPROACHES
I tried to constuct my formula the same as seen here but it does not work for me.
My flow has the following 2 parallel branches to send an email. Both have the same AND portion of Status='Pending HR Approval'.
#1 should send email 1 only when the location is Perrysburg or Bridgewater.
#2 should send email 2 if the location is anything other than Perrysburg or Bridgwater (thus NOT Perrysburg or Bridgwater).
How it currently works with the formulas below:
1-The problem is that if the location is either Perrysburg or Bridgwater, both email 1 AND email 2 is sent. This is Incorrect as only email 1 should be sent
2-If the location is anything other than Perrysburg or Bridgwater, email 2 is sent. This is Correct!
#1
@AND(
equals(body('Get_item')?['Status'],'Pending HR Approval'),
OR(
equals(body('Get_item')?['Internship_x0020_Location']?['Value'],'Perrysburg'),
equals(body('Get_item')?['Internship_x0020_Location']?['Value'],'Bridgwater')
)
)
#2
@AND(
equals(body('Get_item')?['Status'], 'Pending HR Approval'),
OR(
not(equals(body('Get_item')?['Internship_x0020_Location']?['Value'], 'Perrysburg')),
not(equals(body('Get_item')?['Internship_x0020_Location']?['Value'], 'Bridgwater'))
)
)
@Anonymous Please share a screen shot of the parrallel branch if possible.
I'm not sure I can or how it would be helpful to you. The flow scrolls off my screen to the right and you can't see much of the condition because the box is so small.
Is there anything else I can tell you to help? What would I need to change in the conidtions to make it work?
Hi @Anonymous,
1. Do not use parallel branch for this.
2. This is a simple case where: Using case 1 as you mentioned will do the work:
#1
@AND(
equals(body('Get_item')?['Status'],'Pending HR Approval'),
OR(
equals(body('Get_item')?['Internship_x0020_Location']?['Value'],'Perrysburg'),
equals(body('Get_item')?['Internship_x0020_Location']?['Value'],'Bridgwater')
)
)
3. Add the above condition in "IF" condition, if result is "YES" send "Email1" , for result "NO" send "Email2".
4. Remove Parallel branch.
Let me know for queries, if not clear.
Regards,
Chandrashekhar,
Pune, India.
Hi @Anonymous
Just a small advice, regarding your printscreens.
You can hold CTRL and move mouse wheel to make your flow smaller.
Proud to be a Flownaut!
Thanks for the tip!
Thank you for your response. The problem is that if I put this into the No part without a condition, this is triggered for other status' (i.e. Status=Denied which I have another branch for). If I add a condition then I'm in the same boat of not being able to get the condition formula to work.
Can you take a look at my 2 formulas and tell me what's wrong with them? Why doesn't #1 work?
How it currently works with the formulas below:
1-The problem is that if the location is either Perrysburg or Bridgwater, both email 1 AND email 2 is sent. This is Incorrect as only email 1 should be sent
2-If the location is anything other than Perrysburg or Bridgwater, email 2 is sent. This is Correct!
#1
@AND(
equals(body('Get_item')?['Status'],'Pending HR Approval'),
OR(
equals(body('Get_item')?['Internship_x0020_Location']?['Value'],'Perrysburg'),
equals(body('Get_item')?['Internship_x0020_Location']?['Value'],'Bridgwater')
)
)
#2
@AND(
equals(body('Get_item')?['Status'], 'Pending HR Approval'),
OR(
not(equals(body('Get_item')?['Internship_x0020_Location']?['Value'], 'Perrysburg')),
not(equals(body('Get_item')?['Internship_x0020_Location']?['Value'], 'Bridgwater'))
)
)
Hi @Anonymous,
Change formula 2 to as below:
#2
@AND(
equals(body('Get_item')?['Status'], 'Pending HR Approval'),
AND(
not(equals(body('Get_item')?['Internship_x0020_Location']?['Value'], 'Perrysburg')),
not(equals(body('Get_item')?['Internship_x0020_Location']?['Value'], 'Bridgwater'))
)
)
Keep formula 1 as it is.
Check and let me know.
Regards,
Chandrashekhar
This worked, thank you!
As soon as I saw it, I knew you were right but I just could not get it.
Hi @Anonymous,
You are welcome.
Happy to help. Even i am in learning mode.
Regards,
Chandrashekhar
Pune, India.
Hi, this condition is not executing Correctly.
@AND(contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], 'txt'),
OR(contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], 'xlsx')))
Hi @Anonymous,
1. Mistake - AND/OR can be applied on two statements. you are using both at the same time.
2. Solution:
AND :
@AND(contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], 'txt'),
(contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], 'xlsx')))
OR :
@OR(contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], 'txt'),
(contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], 'xlsx')))
Please test and let me know for issues.
Regards,
Chandrashekhar
Pune, India.
User | Count |
---|---|
88 | |
37 | |
26 | |
13 | |
13 |
User | Count |
---|---|
127 | |
54 | |
37 | |
24 | |
21 |