cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aadilganie
Advocate V
Advocate V

Use global variable in Item property of Form

Hi Everyone,

 

I have a SharePoint PowerApps custom form which has a parent child relationship. The main problem I have is when users create new or edit existing items on the parent I would like to use the same form for edit and viewing.

 

I have created a global variable called lastID which is set to SharePointIntegration.SelectedListItemID when the form is opened in view/edit. I also set the same variable to form.LastSubmit.ID when the form is new and is submitted.

 

 

The main issue is around creating a parent record and then keeping the form open so users can then add child items to the new records, which also works. However when trying to edit the header form I can't seem to use lastID in the Item property of the form, it only allows specific syntax.

 

I have also tried setting a global variable called isNewItem. If the form is new then it should use form.LastSubmit else use SharePoint.Selected, for some reason however this doesnt work and when I edit the form it does not which ID is within the form.

 

Any ideas that may be able to assist?

 

Thanks in advance!!

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @aadilganie,

 

Which property you used to generate the Variable?

Per my testing, the Variable will not work with the On- related properties.

It will work wtih a button click.

I will make some further tests from my side, and share the results once I got any helpful information.

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi there,

thanks for your reply.

 

 

I am using a button click to set the variable to the latest ID. The form however doesn't allow use of variables in the Item property of the form. I have an If statement in the item property for now. I am setting other variables to achieve the desired outcome but basically it says:

 

IF the form is a new form then use form.LastSubmit.Selected ELSE use SharePointIntegration.Selected

 

Thanks!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,006)