code for Submit Button:
UpdateContext({LineMananger: IfError(Office365Users.ManagerV2(FRM_TNU_Submit_CB_UserName_1.Selected.Email).displayName, "")}); //gets line manager from AD if avaliable and supresses error if it's not available
Collect(StepsPassedLabel, {Key: CountRows(StepsPassedLabel) + 1, Label: "T new user ticket 2"}); //Adds this screen to the StepsPassedLabel collection as the universal back removes one entery for there so this prevents a it falling out of step
UpdateContext({TimerGo: true}); //activates timer that casuses the "..." to change in the "Submitting ticket..." overlay
UpdateContext({FlowResponse: {flowcomplete:"Y"}}); //changes the local variable of flow complete to "Y" which makes the "submitting ticket" .
//The below submits the data from the form into Power Automate
UpdateContext({FlowResponse:Flw_NewUser2.Run(
(JSON(AttatchmentArray, JSONFormat.IncludeBinaryData & JSONFormat.IgnoreUnsupportedTypes)),
SubjectLine, //The ticket subject created by string manipulation in the page "OnVisible"
(Concat( FRM_TNU_Submit_1.SelectedItems, DisplayName & "" )),
FRM_TNU_Submit_RB_UserType_1.SelectedText.Value,
FRM_TNU_Submit_DP_StartDate_1.SelectedDate,
(Concat( FRM_TNU_Submit_CB_TrainingDutyMangerHeading_1.SelectedItems, DisplayName & "" )),
FRM_TNU_Submit_RB_GDPR_1.SelectedText.Value,
FRM_TNU_Submit_Txt_TokenID_1.Text,
FRM_TNU_Submit_Txt_Passcode1_1.Text,
FRM_TNU_Submit_Txt_Passcode2_1.Text,
If(IsBlank(FRM_TNU_Submit_CB_CC_1),"",(Concat( FRM_TNU_Submit_CB_CC_1.SelectedItems, Email & ";" ))), //Passes the CC'd people as one email ready string unless CC is blank then it passes ""
(Concat( FRM_TNU_Submit_CB_UserName_1.SelectedItems, Email & "" )),
If(IsBlank(LineMananger), "", LineMananger)
)}); //Passes the attatchments as JSON
//If flow succeeds set message to say so
If(FlowResponse.flowcomplete = "1", UpdateContext({TimerGo: false}) && Navigate(Confirmation,ScreenTransition.Cover) && Set(ConfrMsg, "Your request has been submited and a ticket raised.<br/><br/>The <b>team</b> will contact you shortly.") && Set(ConfrHead, "Confirmation"),
//If flow fails set message to say so
If(FlowResponse.flowcomplete = "0", UpdateContext({TimerGo: false}) && Navigate(Confirmation,ScreenTransition.Cover) && Set(ConfrMsg, "If the issue persists, please contact ServiceDesk directly:<br/><br/>Email: <a href='mailto:example@domain.org.uk
"");
Set(FormActive, true); //Global variable that clears forms when set to false
Collect(Advice, "*!^%5"); //Adds a value to the advice collection to stop it getting out of step when the back button is used - anything with *!^% is the same as blank