cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to populate a field on a newform with data from a detailform where the addcontrol originated?

I am trying to make a powerapp based on Dynamics 365 Sales-data. I started with an app based on the account dataset. On the Account DetailScreen I am trying to make an add-control to create a new opportunity for the account. I want to autopopulate the accountfield in the opportunity with the account that was shown on the Account DetailScreen, but am not succeeding.

 

So far my formula is as follows

NewForm(NewOpportunityForm) ; Navigate(EditOpportunityScreen , ScreenTransition.None , { _parentaccountid_value : accountid } )

 

The NewForm and Navigate parts of the formula work. The update field part does not. Adding Account. or ThisItem. before the column name accountid does not work eather.

 

Anny suggestions how to fix this?

1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Community Champion
Community Champion

Hello Rebekka,

what you need to do is to change the Default property of the account field datacard (or the Default property of its main control, which should be a text input or a dropdown) of the NewOpportunityForm.  You may need to unlock the datacard in order to be able to edit its properties or those of its controls.

 

The Default property will need to be set in such a way as to pick up the accountid from the AccountDetail screen.  How this is done depends on how you select the account in the AccountDetail screen and what context variables contain this.  Is it accountid?

 

If so, then you correctly set the _parentaccountid_value to account id as you have done.  The Default property then should simply be set to _parentaccountid_value

 

Please let me know if this works, and if it has not, then additional details /screenshots to be able to help you.

View solution in original post

4 REPLIES 4
Meneghino
Community Champion
Community Champion

Hello Rebekka,

what you need to do is to change the Default property of the account field datacard (or the Default property of its main control, which should be a text input or a dropdown) of the NewOpportunityForm.  You may need to unlock the datacard in order to be able to edit its properties or those of its controls.

 

The Default property will need to be set in such a way as to pick up the accountid from the AccountDetail screen.  How this is done depends on how you select the account in the AccountDetail screen and what context variables contain this.  Is it accountid?

 

If so, then you correctly set the _parentaccountid_value to account id as you have done.  The Default property then should simply be set to _parentaccountid_value

 

Please let me know if this works, and if it has not, then additional details /screenshots to be able to help you.

View solution in original post

Anonymous
Not applicable

I found out what the problem was. The addcontrol was not properly set to the AccountViewForm. Instead it was set on the screen. So it missed context. When I moved it to a card on the form problem was solved.

Meneghino
Community Champion
Community Champion

OK, glad you got it solved

Anonymous
Not applicable

I think there is a bug somewhere, because it stopped working all of a sudden. Weird.

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,400)