}
// If an action failes inside a scope, and a suitable action isn't found inside the given scope, that
// actions status is transferred to be the scope status. This isn't the case atm
// TODO: Figure out how to get actionResult from
var actionDescName = currentAd.Name;
var nextAction = actionResult.NextAction;
var actionResultStatus = actionResult.ActionStatus;
while (!DetermineNextAction(nextAction, actionResultStatus, out currentAd, actionDescName))
{
nextAction = null;
var t = await _scopeManager.TryPopScope(actionResultStatus);
if (t == null)
{
currentAd = null;
break;
}
actionResultStatus = t.ActionStatus;
actionDescName = t.NextAction;
}
}
}
private bool DetermineNextAction(string nextAction, ActionStatus actionResultStatus,
out JProperty currentActionDesc, string adName)
{
if (nextAction == null)
{
currentActionDesc = _scopeManager.CurrentActionDescriptions.FirstOrDefault(a =>
a.Value.SelectToken("$.runAfter").First?.ToObject<JProperty>().Name == adName &&
a.Value.SelectToken("$.runAfter.*").Values().Any(
x => x?.Value<string>() == actionResultStatus.ToString()));
}
else
{
currentActionDesc =
_scopeManager.CurrentActionDescriptions.First(a => a.Name == nextAction);
}
return currentActionDesc != null;
Figure out how to get actionResult from
https://github.com/thygesteffensen/PowerAutomateMockUp/blob/1127c4f7acf55eaecbf30df2821fc7e4229e9c00/PowerAutomateMockUp/FlowParser/FlowRunner.cs#L92
8e8ed17bda40c7c678dbc13b1370231c8c95a61d