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 Apps
Answered

Form Modes

(1) ShareShare
ReportReport
Posted on by 60
I am building an app that in theory will open the existing record on the SP list if it exists.  If it does not exist I can add a new record.  
 
This is what I have in the form Item:  
 
If(IsBlank(LookUp(Gate1,ThisRecord.ID = galProjects.Selected.ID)),FormMode.New)
 
What am I missing?
 
Thanks in advance for any and all guidance!
Kim
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,024 Most Valuable Professional on at
    I think you want IsEmpty() instead of IsBlank(). Is Blank is used with a string, Is Empty is used with a record or table. The output of your Lookup is a record, not a string.  It would also work if you have the Lookup return a single string field like Title.  Like this
    If(IsBlank(LookUp(Gate1,ThisRecord.ID = galProjects.Selected.ID,Title)),FormMode.New)

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Verified answer
    Mitanshu Profile Picture
    1,654 Moderator on at

    The FormMode.New is not a valid value for the Item property. Instead, Item expects a specific record or Blank() to determine whether the form will open an existing record or allow creating a new one.

    Item property of Form:

    If(
        IsBlank(LookUp(Gate1, ID = galProjects.Selected.ID)),
        Blank(),
        LookUp(Gate1, ID = galProjects.Selected.ID)
    )

    Setting Form Mode

    To determine whether the form should be in New or Edit mode, use the OnVisible or OnSelect property of your screen or button to set the form's mode explicitly.

    If(
        IsBlank(LookUp(Gate1, ID = galProjects.Selected.ID)),
        NewForm(Form1),
        EditForm(Form1)
    )
  • Khibby Profile Picture
    60 on at
    I've tried this method but keep getting a type mismatch error.  This is what I have OnSelect of the button:
    If(IsBlank(LookUp(Gate1, ProjectID = galProjects.Selected.ProjectID)), NewForm(frmGate1), EditForm(frmGate1))
     
    Apparently the data type in the Gate1 list is text and the gallery holds records.  How do I tell it to search the record for that text string?  
  • Khibby Profile Picture
    60 on at
    I was able to fix the error by changing SP column to ProjectID.Value.  So the whole thing is: 
     
    If(IsBlank(LookUp(Gate1, ProjectID.Value = galProjects.Selected.ProjectID)), NewForm(frmGate1), EditForm(frmGate1));Navigate('Gate-1')
     
    However, my form isn't loading the data that exists on Gate1.  
  • timl Profile Picture
    36,715 Super User 2026 Season 1 on at
    >> However, my form isn't loading the data that exists on Gate1.  
     
    With regards to this issue, have you set the Item property of your form to this?
     
    LookUp(Gate1, ProjectID.Value = galProjects.Selected.ProjectID)
     
  • Khibby Profile Picture
    60 on at
    Yes, that's correct.  
     
    Button on Screen1 - OnSelect: 
    If(IsBlank(LookUp(Gate1, ProjectID.Value = galProjects.Selected.ProjectID)), NewForm(frmGate1), EditForm(frmGate1));Navigate('Gate-1')
     
    Form on Screen2 (frmGate1) Item:
    LookUp(Gate1, ProjectID.Value = galProjects.Selected.ProjectID)
     

    Thank you for your continued support on this! It's much appreciated.
    Kim
  • timl Profile Picture
    36,715 Super User 2026 Season 1 on at
     
    If none of the fields are loading on the form, I'd suggest going to the Fields link in the properties of the form and re-adding the cards for the fields. That should reset things and may help.  

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard