
I'm using a flow in PowerApps which selects an email template to send a email whenever the case is created. This flow works when I run it inside the power automate env. but when i try to trigger the flow its giving me bad gateway error
UpdateContext({show_Notification: false});
UpdateContext({currentUser: User().FullName});
UpdateContext(
{
email_ccList: Concat(
Filter(
colAssignee,
Case_ID = VarA.Case_ID
),
Assignee_Email & ","
)
}
);
UpdateContext({email_Title: currentUser & " has reponed (" & VarA.Case_ID & ") in Case management tool and assigned to you"});
UpdateContext(
{
selectedCase_assignees: SortByColumns(
Filter(
colAssignee,
Case_ID =VarA.Case_ID
),
"Assignee_Sequence"
)
}
);
ClearCollect(
case_allAssignees,
{}
);
ForAll(
selectedCase_assignees,
Collect(
case_allAssignees,
{
name: selectedCase_assignees[@Assignee_Name],
assignee_ID: selectedCase_assignees[@Assignee_UserID],
segment: LookUp(
USERS,
Users_ID = selectedCase_assignees[@Assignee_UserID]
).Users_Segment,
business: LookUp(
USERS,
Users_ID = selectedCase_assignees[@Assignee_UserID]
).Users_BU,
team: LookUp(
USERS,
Users_ID = selectedCase_assignees[@Assignee_UserID]
).Users_Team,
expectedTime: selectedCase_assignees[@SLA_DATE1],
dependency_text: If(
IsBlank(selectedCase_assignees[@DependAssignee_UserID]),
"N/A",
"Response from "
),
dependency_assignee: LookUp(
USERS,
Users_ID = selectedCase_assignees[@DependAssignee_UserID]
).Users_Team,
isCurrent: If (
(selectedCase_assignees[@Assignee_Email] = selected_Case.CurrentAssignee_Email),
"Yes",
"No"
)
}
)
);
ClearCollect(TitleSetting,GetEmailTemplate.Run(5));
ClearCollect(
SubjectSessionInfo,
{ i:0,
value: VarA.Case_ID}
);
ClearCollect(
BodySessionInfo,
{ i:0,
value: VarA.Case_ID},
{
i:1,
value: LookUp(
CASES,
Case_ID = VarA.Case_ID
).Case_BU},
{
i:2,
value: tempTableDetail}
);
ForAll(SubjectSessionInfo, Patch(TitleSetting, LookUp(TitleSetting, ID="5"),
{Subject: Replace(LookUp(TitleSetting, ID="5").Subject,
Find("{"& SubjectSessionInfo[@i] & "}", LookUp(TitleSetting, ID="5").Subject),
Len("{"& SubjectSessionInfo[@i] & "}"), SubjectSessionInfo[@value])
}));
ForAll(BodySessionInfo, Patch(TitleSetting, LookUp(TitleSetting, ID="5"),
{Body: Replace(LookUp(TitleSetting, ID="5").Body,
Find("["& BodySessionInfo[@i] & "]", LookUp(TitleSetting, ID="5").Body),
Len("["& BodySessionInfo[@i] & "]"), BodySessionInfo[@value])
}));
Set(emailPreview_body, LookUp(TitleSetting, ID="5").Body);
Set(emailPreview_subject, email_Title);
Set(email_currentAssignee, Drp_NewCommunication_Assignee.Selected.Assignee_Email);
Set(email_CCaddress, email_ccList);
I get the following error message:
flow.Run failed: { "error": { "code": 502, "source": "msmanaged-na.azure-apim.net", "clientRequestId": "########", "message": "BadGateway", "innerError": { "error": { "code": "NoResponse", "message": "The server did not receive a response from an upstream server. Request tracking id '############." } } } }
I'm confused on why it works inside the app when I run and edit it, but it does not work outside of the app when I play it or share it.
However when i run the flow from power Automate its running fine.
Thanks, in advanced.
Hi @Anonymous ,
Apparently, there isn't this action in your flow because the flow has run successfully when it was triggered separately. When you have a flow run in a Canvas App for generating or updating Collections and Variables, you will need a Respond action in your flow.
The respond to an App or flow action allows you pass Text, Boolean, Number, Date, Email etc. values to your App.
The Response action allows you pass all kinds of values to your App.
Solved: Passing Parameters from a Flow to an App - Power Platform Community (microsoft.com)
Best regards,