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 Apps / Where am I going wrong...
Power Apps
Unanswered

Where am I going wrong this If statement?

(0) ShareShare
ReportReport
Posted on by 321

Hi, 

 

Bit of background, I have a Commission App, there are two types of user, end user submitting a commission, and admin reviewing, approving/editing the commissions. 

 

For the end user, when they are completing the form, I wanted to give them an option to save as draft, so I created a choice column on my SharePoint List. To achieve the result I needed, I applied a local variable on two buttons on the form. 

 

Draft Button - and put the following on the OnStart, UpdateContext({locDraftSubmit:false})

Submit button - and put the following on the OnStart, UpdateContext({locDraftSubmit:true})
On the Update property the forms Datacard I had the following code:

If(locDraftSubmit,{Value:"Submitted"},{Value:"Draft"})

This worked from, it updated the status column to Draft or Submitted depending on which button was pressed.

The problem I had was when admins edited and save any items, it changed the Status, so in an effort to get round this I created a variable which checks if the logged in user is on the admin list, and put this following code in the Update property...

If(varIsGlobalAdmin,ThisItem.Status.Value, If(locDraftSubmit,{Value:"Submitted"},{Value:"Draft"})


My intention being to say If the user is on the admin list, save whatever is in ThisItem, but if the user isnt admin, then do the If(locDraftSubmit,{Value:"Submitted"},{Value:"Draft"}) part.

But I get the error Invalid argument type record, expected Text value. Where am I going wrong?

Thanks in advance.

 

Categories:
  • LaurensM Profile Picture
    12,516 Moderator on at

    @JimboSey would it be possible to change the ThisItem.Status.Value by the name of the dropdown append it with .Selected (not the data card but the actual dropdown in that datacard). I will add an example below:

    If(varIsGlobalAdmin,DataCardValue5.Selected, If(locDraftSubmit,{Value:"Submitted"},{Value:"Draft"})

     
    If this solves your question, would you be so kind as to accept it as a solution.
    Thanks!

  • JimboSey Profile Picture
    321 on at

    Hi, thanks for the reply. 

    I tried your suggestions but same error. I have a screenshot below...

    JimboSey_0-1671134377943.png

     



  • LaurensM Profile Picture
    12,516 Moderator on at

    @JimboSey your first If statement is not closed. Could you add ) to the end of the function.
    Should you still have an error after this, could you retry my initial suggestion?

  • JimboSey Profile Picture
    321 on at

    Hi, 

    Here is the updated version as I interpreted your reply, 

    JimboSey_0-1671135770148.png

     

  • LaurensM Profile Picture
    12,516 Moderator on at

    @JimboSey ok thank you for the screenshot. Strange in my case I get the error 'expects a record value instead', so the complete opposite.

    However, in your case you might have to change it to this:

    If(varIsGlobalAdmin,ThisItem.Status.Value, If(locDraftSubmit, "Submitted", "Draft"))


    Could you give this a try?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard