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

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

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

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

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

 

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

 

Highlighted
Frequent Visitor

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

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

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

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
Frequent Visitor

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

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!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,212)