cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Show form in either edit mode and new mode based on items in list

Hi There

 

I have two sharepoint lists ListA and ListB. ListB has a lookup field to JobNumber in ListA.

I have created a powerapp that displays the ListA in a gallery when the item is selected in the gallery I want to show the form either with the edit mode (If a record already exists in ListB) or new mode (If there is not yet a record in ListB using that particular JobNumber).

I am unsure of how I can display the form in either edit or new mode based on items in ListB

 

I have tried doing an IF statemtent on the DefaultMode of the form along the lines of:

If(IsBlack(LookUp('ListB', JobNumber=gallery1.selected.JobNumber)), FormMode.New, FormMode.Edit)

 

 

However I get an invalid argument error. I have also tried searching for a solution but have been unsuccessful.

Any help would be much appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver III
Resolver III

ISBlank is looking for a value, the lookup is returning a record.

 

To help with your formula, if JobNumber is the Lookup Column name in ListB, try something like this:

 

If(IsBlank(LookUp('ListB',Gallery1.Selected.ID = JobNumber.Id,JobNumber.Id)),FormMode.New, FormMode.Edit)

 

View solution in original post

4 REPLIES 4
Highlighted
Resolver I
Resolver I

You could simplify your formula by using the 'in' operator:

 

if(Gallery1.Selected.JobNumber in ListB.JobNumber, FormMode.Edit, FormMode.New)

 

Frequent Visitor

Thanks for this however I am getting the following error "Cannot automatically convert this Text value to a Record"

Is this because gallery1.selected.JobNumber is a text field whereas ListB.JobNumber is a lookup?

Highlighted
Resolver III
Resolver III

ISBlank is looking for a value, the lookup is returning a record.

 

To help with your formula, if JobNumber is the Lookup Column name in ListB, try something like this:

 

If(IsBlank(LookUp('ListB',Gallery1.Selected.ID = JobNumber.Id,JobNumber.Id)),FormMode.New, FormMode.Edit)

 

View solution in original post

Highlighted

Awesome. Thank you that worked and was exactly what I was after.

Much apprciated.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,071)