cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Champion
Community Champion

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

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
Highlighted
Community Champion
Community Champion

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

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

Highlighted
Anonymous
Not applicable

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

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.

Highlighted
Community Champion
Community Champion

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

OK, glad you got it solved

Highlighted
Anonymous
Not applicable

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

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

Helpful resources

Announcements
Check this Out

Announcing

Class of 2020- Season 2

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,109)