cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Sending an email with if various statements

Hey all,

 

I have the following on my OnSuccess:

 

Office365Outlook.SendEmailV2(Form1_9.LastSubmit.ApplicantName.Email, " Ref: " & DataCardValue77_1, "The Manager has sent you the outcome of the application Ref: " & DataCardValue77_1 

& 

If(DataCardValue70_1.Text = "Rejected" Or DataCardValue71_1.Text = "Rejected" Or DataCardValue72_1.Text = "Rejected" Or DataCardValue73_1.Text = "Rejected" Or DataCardValue74_1.Text = "Rejected" Or DataCardValue75_1.Text = "Rejected" Or DataCardValue76_1.Text = "Rejected" Or DataCardValue22.Text = "Rejected", "<br> Your application for " & vItem.RequestFor.Value & " has been <b>rejected.</b> <br>  See response(s) for rejection:" )

&

If(DataCardValue70_1.Text = "Authorised" Or DataCardValue70_1.Text = "Conditional" Or DataCardValue70_1.Text = "N/A"  And DataCardValue71_1.Text = "Authorised" Or DataCardValue71_1.Text = "Conditional"  Or DataCardValue71_1.Text = "N/A" And DataCardValue72_1.Text = "Authorised" Or DataCardValue72_1.Text = "Conditional" Or DataCardValue72_1.Text = "N/A" And DataCardValue73_1.Text = "Authorised" Or DataCardValue73_1.Text = "Conditional" Or DataCardValue73_1.Text = "N/A" And DataCardValue74_1.Text = "Authorised" Or DataCardValue74_1.Text = "Conditional" Or DataCardValue74_1.Text = "N/A" And DataCardValue75_1.Text = "Authorised" Or DataCardValue75_1.Text = "Conditional" Or DataCardValue75_1.Text = "N/A" And DataCardValue76_1.Text = "Authorised" Or DataCardValue76_1.Text = "Conditional" Or DataCardValue76_1.Text = "N/A" And DataCardValue22.Text = "Authorised" Or DataCardValue22.Text = "Conditional" Or DataCardValue22.Text = "N/A", "<br> Your application for " & vItem.RequestFor.Value & " has been <b>authorised or Conditional.</b><br>  See response(s) and any condition(s) if applicable:" )

&
" <br><br><b> BM - Outcome: </b> " & DataCardValue70_1.Text &
If(DataCardValue70_1.Text = "Rejected", "<br><b>The reason(s) the BM rejected this is:</b> <br>" & vItem.PartLRejection) & If(DataCardValue70_1.Text = "Conditional", "<br><b>The condition(s) the BM has authorised with is:</b> <br>" & vItem.PartLConditions) & 

etc etc.......

The problem is, if the Value in any of the 1st statement are 'rejected', the 2nd statement should not trigger - by default the application is rejected.

e.g. If any 1 of the 8 values are equal to rejected, only the first if statement should activate.

With the code I have written both the if statements are triggering.
In the test item, I have a couple of rejected values and a couple of authorised, the email being sent contains both the above values as both are 'true', I need help changing the code to allow only the rejected statement to be sent to the applicant if any 1 of the values are rejected, of course if any do not contain rejected the next If statement to kick in please

 

Thank you in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Resident Rockstar
Resident Rockstar

Hi,

Yous can try with Nested If, Hope that will help you to resolve your Issue.

Like below,

If(DataCardValue70_1.Text = "Rejected"
Or DataCardValue71_1.Text = "Rejected"
Or DataCardValue72_1.Text = "Rejected"
Or DataCardValue73_1.Text = "Rejected"
Or DataCardValue74_1.Text = "Rejected"
Or DataCardValue75_1.Text = "Rejected"
Or DataCardValue76_1.Text = "Rejected"
Or DataCardValue22.Text = "Rejected",
"<br> Your application for " & vItem.RequestFor.Value & " has been <b>rejected.</b> <br> See response(s) for rejection:",

If(DataCardValue70_1.Text = "Authorised" Or
DataCardValue70_1.Text = "Conditional" Or
DataCardValue70_1.Text = "N/A"
And DataCardValue71_1.Text = "Authorised"
Or DataCardValue71_1.Text = "Conditional"
Or DataCardValue71_1.Text = "N/A"
And DataCardValue72_1.Text = "Authorised"
Or DataCardValue72_1.Text = "Conditional"
Or DataCardValue72_1.Text = "N/A"
And DataCardValue73_1.Text = "Authorised"
Or DataCardValue73_1.Text = "Conditional"
Or DataCardValue73_1.Text = "N/A"
And DataCardValue74_1.Text = "Authorised"
Or DataCardValue74_1.Text = "Conditional"
Or DataCardValue74_1.Text = "N/A"
And DataCardValue75_1.Text = "Authorised"
Or DataCardValue75_1.Text = "Conditional"
Or DataCardValue75_1.Text = "N/A"
And DataCardValue76_1.Text = "Authorised"
Or DataCardValue76_1.Text = "Conditional"
Or DataCardValue76_1.Text = "N/A"
And DataCardValue22.Text = "Authorised"
Or DataCardValue22.Text = "Conditional"
Or DataCardValue22.Text = "N/A",
"<br> Your application for " & vItem.RequestFor.Value & " has been <b>authorised or Conditional.</b><br> See response(s) and any condition(s) if applicable:" ),etc

)

View solution in original post

2 REPLIES 2
Resident Rockstar
Resident Rockstar

Hi,

Yous can try with Nested If, Hope that will help you to resolve your Issue.

Like below,

If(DataCardValue70_1.Text = "Rejected"
Or DataCardValue71_1.Text = "Rejected"
Or DataCardValue72_1.Text = "Rejected"
Or DataCardValue73_1.Text = "Rejected"
Or DataCardValue74_1.Text = "Rejected"
Or DataCardValue75_1.Text = "Rejected"
Or DataCardValue76_1.Text = "Rejected"
Or DataCardValue22.Text = "Rejected",
"<br> Your application for " & vItem.RequestFor.Value & " has been <b>rejected.</b> <br> See response(s) for rejection:",

If(DataCardValue70_1.Text = "Authorised" Or
DataCardValue70_1.Text = "Conditional" Or
DataCardValue70_1.Text = "N/A"
And DataCardValue71_1.Text = "Authorised"
Or DataCardValue71_1.Text = "Conditional"
Or DataCardValue71_1.Text = "N/A"
And DataCardValue72_1.Text = "Authorised"
Or DataCardValue72_1.Text = "Conditional"
Or DataCardValue72_1.Text = "N/A"
And DataCardValue73_1.Text = "Authorised"
Or DataCardValue73_1.Text = "Conditional"
Or DataCardValue73_1.Text = "N/A"
And DataCardValue74_1.Text = "Authorised"
Or DataCardValue74_1.Text = "Conditional"
Or DataCardValue74_1.Text = "N/A"
And DataCardValue75_1.Text = "Authorised"
Or DataCardValue75_1.Text = "Conditional"
Or DataCardValue75_1.Text = "N/A"
And DataCardValue76_1.Text = "Authorised"
Or DataCardValue76_1.Text = "Conditional"
Or DataCardValue76_1.Text = "N/A"
And DataCardValue22.Text = "Authorised"
Or DataCardValue22.Text = "Conditional"
Or DataCardValue22.Text = "N/A",
"<br> Your application for " & vItem.RequestFor.Value & " has been <b>authorised or Conditional.</b><br> See response(s) and any condition(s) if applicable:" ),etc

)

View solution in original post

@VijayTailor 

I've had another bash and I can see where I made the error, I will test further but think this is working

Thanks, will confirm and mark your suggestion as an answer later

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (2,904)