cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eTheory
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
ChrisR
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
CMee
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)

 

eTheory
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?

ChrisR
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

eTheory
Frequent Visitor

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

Much apprciated.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (57,483)