web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / The second argument to...
Power Automate
Unanswered

The second argument to the left function' is invalid.

(0) ShareShare
ReportReport
Posted on by 16

Hello,

I am a new user to power apps and have started overseeing our ticketing system, which is deployed as a Canvas app.

 

I have a screen within Power apps which is causing a runtime error for 'the second argument to the left function' is invalid. The results are being presented as boolean rather than string value.

 

The screen essentially generates a ticket and send a copy to the line manager and helpdesk for approval. 
Screen

ma770_0-1690476601301.png

 


Submit background

ma770_1-1690476601265.png

 



Submit Button:

ma770_2-1690476601497.png

 

 

ma770_3-1690476601408.png

 

 

Power Automate:

ma770_4-1690476601378.png

 

ma770_5-1690476601400.png

 

ma770_6-1690476601456.png

 

 

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,636 Super User 2026 Season 1 on at

    Hi @ma770 ,

     

    Can you please post the screenshots at full size? They are not readable currently:

     

    BCBuizer_0-1690547750352.png

     

    I did find this topic which may shine a light on your issue: https://powerusers.microsoft.com/t5/Building-Power-Apps/Sporadic-issue-The-second-argument-to-the-Left-function-is/td-p/1510408

     

  • ma770 Profile Picture
    16 on at

    Hello, 

    See below the Onvisble for the screen when patching:



    Patch('Steps, Defaults('Steps'), {Title:Self.Name, User:User().FullName, SessionID: SessionID}); //Logs screen, person and time in Help-Steps for app analytics


    UpdateContext({resetCan:false}); //takes you back to the top of the screen when page is reloaded

    //Sets local variable to "X" to hide the "Submitting Ticket..." overlay
    UpdateContext({
    FlowResponse: {
    flowcomplete: "X"
    }
    });

     

    //String manipulation to get the trimmed subject line from the StepsPassedLabel collection
    Set(Sub, Concat( StepsPassedLabel, Label & " - " ));
    Set(Sub1, Substitute(Sub, " - Submit a ticket", ""));
    Set(Sub2, Substitute(Sub1, Left(Sub1, Find(" - ", Sub1)+2), ""));
    Set(SubjectLine, Left(Sub2,Len(Sub2) -3));

  • ma770 Profile Picture
    16 on at

    ma770_0-1690563739428.png

     

    ma770_1-1690563802588.png

     

    ma770_2-1690563817869.png

     

  • ma770 Profile Picture
    16 on at

    ma770_3-1690563850939.pngma770_4-1690563863258.pngma770_5-1690563877620.png

     

  • ma770 Profile Picture
    16 on at

    ma770_6-1690563904120.png

     

  • ma770 Profile Picture
    16 on at

    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

     


  • BCBuizer Profile Picture
    22,636 Super User 2026 Season 1 on at

    HI @ma770 ,

     

    Can you give an example of the values of the variables in the below formula when you get this error?

     

    Set(Sub, Concat( StepsPassedLabel, Label & " - " ));
    Set(Sub1, Substitute(Sub, " - Submit a ticket", ""));
    Set(Sub2, Substitute(Sub1, Left(Sub1, Find(" - ", Sub1)+2), ""));
    Set(SubjectLine, Left(Sub2,Len(Sub2) -3));

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard