Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How do I get my field to populate with Parent.Default and keep some custom coding?

(0) ShareShare
ReportReport
Posted on by 825 Super User 2025 Season 1

I have a form that I want to populate when a user clicks on a 'Copy' button. So far I have the button set up to copy the currently selected record from a gallery and store that in a global variable like this:

 

Set(
 glbFormData,
 GAL_Campaigns.Selected
);
Set(
 varCopy,
 true
);
EditForm(FRM_CampaignForm);
Navigate('Create Campaign')

 

For my form most fields I can get away with using this in the 'Default' property

Parent.Default

 

Or this in the 'DefaultSelectedItems' property.

[Parent.Default]

 

But I run into trouble with some of my other comboboxes. For example, I have a combobox that has this code in the 'DefaultSelectedItems' property.

If(
 Self.DisplayMode=DisplayMode.Edit && Text(RB_Partnering.Selected.Value) = "Yes", 
 If(
 IsBlank(newPartner),
 {CB_PartnerName:Parent.Default},
 newPartner
 ), 
 Blank()
)

 

In this case I haven't figured out a way to populate that field with the record value. Is there a way to do this? 

 

NOTE: The last bit of code is on a combobox that is part of a two step process. If the user can not find the value they are looking for they can click an 'Add' button which hides the combobox and presents them with a text field where they can enter the missing value. Once entered they can click 'Add' and the text field and button are hidden and the original combobox comes back and is populated with the value they just entered.

  • rpersad Profile Picture
    726 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    Sorry for this late reply but glad you were able to sort out the issue. Ensure that you select the solution that worked for you to close off this thread.

  • Verified answer
    futr_vision Profile Picture
    825 Super User 2025 Season 1 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    Ok. Figured it out. It's the CB_PartnerName. That is not the name of the column. Once I changed that it worked. Simple answer which I feel like you may have answered earlier but I didn't understand.

  • futr_vision Profile Picture
    825 Super User 2025 Season 1 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    @rpersad 
    This looks right but the combo box just doesn't display the value

    futr_vision_0-1717078803380.png

     

  • futr_vision Profile Picture
    825 Super User 2025 Season 1 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    Sure. Let me see if I can explain. 

    1. There is a set of radio buttons *yes/no). If the 'Yes' radio button is selected then the Partner Name datacard is shown. This datacard contains a combo box (visible) with a list of partner names and a text input field (hidden). 
    2. If the partner name is not in the list the user can click "Add new partner" which hides the Partner Name combo box and unhides the text input field.
    3. Once you type in a new partner name you can click "Add" and the text input field is hidden and the combo box is unhidden and populated with the new partner name. 

    That is the basic functionality when creating a new record. That works great. What I am stuck on is copying a record. 

    1. The user can select a record from a gallery and click a "Copy" button
    2. This puts the record in a global variable and navigates the user back to the form. 
    3. The user should see all fields filled out with the data from the record. 

    This is where my issue is. Most fields get populated using Parent.Default or [Parent.Default]. It's just the combo boxes, that have this mechanism that allow the user to add a new record to the source data for the combo box, that fail to populate. As I mentioned in a previous post that if I remove the code that is currently there and use [Parent.Default] I see what I would expect to see. It's something about the code I am using that is preventing [Parent.Default] from being used. 

     

    It seems to me that it is the {CB_PartnerName: Parent.Default} that is the issue. If I change that entire line to [Parent.Default] (with the code being the combo box's Default property) I get an error stating "Expected Table value"

     

    Does that help any?

  • rpersad Profile Picture
    726 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    Correct, what you would have to do is change the Parent.Default to ThisItem.'Partner Name'.

     

    Apologies, I do not understand the purpose of your code so I am unable to determine if there are any changes that your code requires.

  • futr_vision Profile Picture
    825 Super User 2025 Season 1 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    I have a question though. If that code is placed on the datacard then this code won't work because the parent of the datacard is the form is it not?

     

    {CB_PartnerName:Parent.Default}
  • rpersad Profile Picture
    726 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    So the code that you have is not returning a text value. You can use the Text() function to turn the value into a text value.

  • futr_vision Profile Picture
    825 Super User 2025 Season 1 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    Ok. Currently, the Default property uses ThisItem.'Partner Name'. If I replace that with the code from the combobox DefaultSelectedItems I get and error. 'Expected Text value'

  • rpersad Profile Picture
    726 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    You would have to put the code in the Default property of the datacard

  • futr_vision Profile Picture
    825 Super User 2025 Season 1 on at
    Re: How do I get my field to populate with Parent.Default and keep some custom coding?

    Thanks. Setting the combobox's DefaultSelectedItems to [Parent.Default] certainly works to get the value I am looking for but I am stuck on the part where I am entering the code, that is currently in DefaultSelectedItems, into the datacard for that combobox. Where am I entering that? The Default for the datacard is currently ThisItem.'Partner Name'. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard