web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Relational Field set t...
Power Apps
Answered

Relational Field set to a Default Value in Editform not saving in Dataverse when Submitform is executed

(0) ShareShare
ReportReport
Posted on by 36

I have multiple relational tables.  When I select a row from Table A on the primary screen, I display all related rows from Table B on a second screen, with the option to "Add a new Row".  When I select the "Add New Row", it throws the form into Edit Mode, and I can add all the data.  One field in this form is the Primary Key to Table A (to create the relationship).  I have the editform set up to place the default value in the Key Filed Datacard, and I see it there on the form, but when I click on the submitform, everything entered into the form is saved EXCEPT for the field I set the default for.  Thus, I get no relationship.

For the Default Value of the datacard for the ID field, I have the following...

 

If(EditForm_Installations.Mode = FormMode.New, VarRecord.Server_ID,ThisItem.DB_Install_Server_ID)

 

And, as I stated, I see the value there.

The Submit is just a simple 

 

SubmitForm(EditForm_Installations)

Categories:
I have the same question (0)
  • espencere756 Profile Picture
    36 on at

    When I stated "And, as I stated, I see the value there.", I am seeing the value on the form, it is just not writing to the new row in Dataverse.

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @espencere756 ,

     

    May I ask what Formula you have used about varRecord?

     

    We assume the formula of varRecord blow.

    vhanytianmsft_0-1689052975850.png

     

     

    To fill the data in the Table B, we suggest use formula Lookup().

    DefaultSelectedItems:

    If(Form1.Mode = FormMode.New,LookUp('0711AS',Name in VarRecord.Server_ID,false))

    vhanytianmsft_1-1689052975856.png

     

    Items:

    Choices([@’Datasouse’].lookUpColumn)

    vhanytianmsft_2-1689052975871.png

     

    Updata of DataCard:        

    DataCardValue3.Selected

    vhanytianmsft_3-1689052975873.png

     

     

    vhanytianmsft_4-1689052975874.png

     

    vhanytianmsft_5-1689052975875.png

     

     

    Hope this will help you,

     

    Best Regards,

    Tina

  • espencere756 Profile Picture
    36 on at

    In the Previous Screen, I have the SET statement defined in the OnSelect property of the Gallery.

     

    UpdateContext({ itemSelected: true, CurrentItem: ThisItem });Set(VarRecord,ThisItem);

     

    In the Editform, In the Card for the ID, I have the following in the "Default" property of the card.

     

    If(EditForm_Installations.Mode = FormMode.New, VarRecord.Server_ID,ThisItem.DB_Install_Server_ID)

     

    I would normally "Hide" this field on the form, as I don't want anyone entering anything in it.  It is to keep the new record relationship to the record on the first screen.  However, for testing, I have made the field visible, and the value is showing when I am either viewing an existing record or if I am adding a new one.  However, when I click save, that is the only field not getting added to the record in the table.

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @espencere756 ,

     

    As your offer, we change formula of the OnSelect in Galley.

    vhanytianmsft_0-1689573680240.png

     

     

    We Suggest change formula of DefaultSelectedItems.

    If(Form1.Mode = FormMode.New, LookUp(Choices([@'0711BS'].LookUpA),Name in VarRecord.Name))

    vhanytianmsft_1-1689573680247.png

     

    Items of DataCardValue.

    Choices([@'0711BS'].tina7_LookUpA)

    vhanytianmsft_2-1689573680250.png

     

    Update of DataCard.

    vhanytianmsft_3-1689573680252.png

     

     

    vhanytianmsft_4-1689573680254.png

     

    vhanytianmsft_5-1689573680255.png

     

    Hope this will help you.

     

    Best Regards,

    Tina

  • espencere756 Profile Picture
    36 on at

    I honestly do not understand this solution...  the field I am trying to store is not a "Choice", it is a relationship filed.  Also, I have had several days looking at each of the fields on the table I am trying to store, and I notice that there is no UPDATE property on that field.  I am very confused why all the other fields in the table have UPDATE, but this one does not.

    I will look further into the "Lookup" you have suggested, but I have never used it before, so I am not sure how to convert what you are suggesting to work with the objects I have on by screen.  But, thank you for your response, I do appreciate it and value your knowledge on the matter.

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @espencere756 ,

     

    Actually, you can use this formula without any doubt.

     

    The type of LookUpA we created is Look up in Dataverse.

    vhanytianmsft_0-1689642617448.png

     

     

    Hope this will help you.

     

    Best Regards,

    Tina

  • Verified answer
    espencere756 Profile Picture
    36 on at

    I have determined the problem.  It has to do with how the table was created.  These is an Access database that I have exported to Dataverse.  I have no control over the data type created as the Export process does the creation.  However,  I believe the big issue has to do with the relationships defined in Access.  I deleted all the tables in Dataverse, and I then removed ALL relationships in Access.  I then performed the Export process again.

    When I created the Screens this time, the field in question NOW has the UPDATE property and I am able to use the same Default formula I started with.  

    Thanks for all of your input on this.  Unfortunately, I am very new to PowerApps, but need to recreate this Access Forms utility in Teams.  I guess I need to sit down and better understand the Lookup functionality.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard