Hi,
Can we set a default value when creating new record ?
Further more, in Header - Detail schema, in the detail part of the table, I've plan to not use the primary field Name so it will be hidden in a form, but I wish to auto populated with some field in the header, can I do that and how ?
Thanks
Solved! Go to Solution.
Hi @Axal ,
There are a number of ways to default data on your child table from your parent table, set the name field automatically, and default other fields as well based on business rules...
1. Table Mappings - Provides ability to map fields from Parent table to child table when creating the child table from the related parent. Example, viewing the Account and creating a child Contact from that Account table. (https://docs.microsoft.com/en-us/powerapps/maker/data-platform/map-entity-fields). This works great if you have the same column on the child table that you want to default from the Parent table...
2. Real-Time Workflows - I use real-time workflows that are run on the Create of the record and will set things like the Name field on the table from multiple other fields. Example, I might set the name field as a concatenation of a couple of fields. (https://docs.microsoft.com/en-us/powerapps/maker/data-platform/overview-realtime-workflows). These are great because they will execute as you create the record so the data will be there right away after you refresh the record vs. waiting for a Power Automate flow to execute or something like that...
3. Business Rules - I use business rules to set fields on the table by default. You can add the Created On to your form (it can be hidden but needs to be on form for the Business Rule to fire). Also, don't add to Footer as the Footers are going away in October! 😁 You can then setup a business Rule that will check if the Created On does not contain data and then set other fields on your form using the Default Value component in the business rules. This will default in the values and allow you to change them as well...
Hope this helps. Please accept if answers your question or Like if helps in some way.
Thanks,
Drew
What kind of data do you wish this to be auto populated with? I presume that auto number option does not fulfill your requirements. Why not put the PFN in the header rather than hide it?
Hi @Ben_C
If PFN by means Primary Field Name, yes it can put in the header part of the form. I'm sorry I hope this term header is not mislead to my original term of header - detail which mean 2 separate table parent - child.
If I'm going to put in the header part of the form, then it is more reasonable to make it filled in by some value.
My Purpose to auto populate at this moment is only because I don't want to leave it blank, but I do not want to use it as user input as well. And as this is on the "detail" part of the relationship (child table), I intend to fill it with the whatever in the Name column from the header table.
At the end of the result is, this PFN going to be displayed in View as a subgrid view of header (parent) main form so user can click this column to display the edit form (main form) of my detail table.
Hope this is make sense.
Thanks,
I think I understand your issue, the primary name field can not have duplicate values. The easiest option I have come across is to set the Primary Name field as an auto number you can choose a prefix to this column such as ChildTable-001, ChildTable-002 etc. These values will be automatically populated when a new record is created. This will then show up in the sub grid.
You can lock the column input on the form which will stop users from being able to fill this in manually.
Hi,
I'm sorry, please cmiiw but we're talking about the column with the flag "Primary Name Column", right? I think although it is Primary, it is allowed to be duplicate. It is the field with data type UniqueIdentifier which is straight forwad not allowed duplicate.
speaking about the auto number, seems it is not good in real life, since it is "detail" or child table, to have number sequence but disregard the parent I would think is useless, something like this if we take example of Order header - Detail (Parent - child) :
It is a lot better to be like this :
But I'm not sure how to achieve this automatically. However currently I don't mind about the number sequence of the child table, it is good to have that kind of result, but to auto populated with the Name's value from the parent table already good.
Thanks.
Hi @Axal ,
There are a number of ways to default data on your child table from your parent table, set the name field automatically, and default other fields as well based on business rules...
1. Table Mappings - Provides ability to map fields from Parent table to child table when creating the child table from the related parent. Example, viewing the Account and creating a child Contact from that Account table. (https://docs.microsoft.com/en-us/powerapps/maker/data-platform/map-entity-fields). This works great if you have the same column on the child table that you want to default from the Parent table...
2. Real-Time Workflows - I use real-time workflows that are run on the Create of the record and will set things like the Name field on the table from multiple other fields. Example, I might set the name field as a concatenation of a couple of fields. (https://docs.microsoft.com/en-us/powerapps/maker/data-platform/overview-realtime-workflows). These are great because they will execute as you create the record so the data will be there right away after you refresh the record vs. waiting for a Power Automate flow to execute or something like that...
3. Business Rules - I use business rules to set fields on the table by default. You can add the Created On to your form (it can be hidden but needs to be on form for the Business Rule to fire). Also, don't add to Footer as the Footers are going away in October! 😁 You can then setup a business Rule that will check if the Created On does not contain data and then set other fields on your form using the Default Value component in the business rules. This will default in the values and allow you to change them as well...
Hope this helps. Please accept if answers your question or Like if helps in some way.
Thanks,
Drew
Hi @Axal apologies I've been getting mixed up with Primary Name and Primary Key.
Hi @Ben_C , no worries. 😀
@dpoggemann , Thanks for the guidance, it is help me a lot of my learning. I'm trying on that Business Rules, it is working nicely. Too bad they can't make the default from the related table though which is the parent table. (unless I don't know how)
Gonna try as well with the real-time workflow.
Thank you.
Hi @Axal ,
Check out #1, this will default fields from the Parent entity when you create the record. There are mapping rules you can put in place if you have same field on Parent and Child tables.
Thanks!
Drew
Hi @dpoggemann ,
Sorry I just a chance to continue this. I've tried the Mapping as well and it is working. So 2 out of 3 from your advice has been done. The confusion is now with the real-time workflow. Based on the link to Microsoft docs and also the page below it, Configure real-time workflow stages and steps in Power Apps - Power Apps | Microsoft Docs
Cannot seem to understand what to do with it. Been googling in hope to find an actual step by step what to do also not succeeded. Is there any good link or someone blog explaining this setup in detail ?
Many thanks for your help..
User | Count |
---|---|
20 | |
11 | |
9 | |
5 | |
5 |
User | Count |
---|---|
32 | |
32 | |
18 | |
17 | |
7 |