cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Madumi
Advocate II
Advocate II

How do I create a custom entity with a "full name" primary field concatenated from first and last names?

I am new to CDS & powerapps, so please forgive my ignorance.

 

I am creating a database which has a Salespeople entity, similar to the Contacts entitiy. Contacts are already in place by default, but I need a "fullname" primary field for the Salespeople entity, just like the default Contacts...

 

How would I accomplish this?

thanks so much!

1 ACCEPTED SOLUTION

Accepted Solutions

Unfortunately there is no way to duplicate the functionality of the contact entity into a new custom entity. Other options are:

  • If you don't use the lead entity, you could repurpose that entity, as the primary field is fullname. However, this would prevent you from using the lead entity for it's normal purpose
  • Create a custom entity, and the name field as the primary field, and separate fields for first and last name. Create a real-time workflow (on Create, and Update of the first or last name fields) to populate the name field from the first and last name. The advantage of doing this rather than a calculated field is that you are populating the primary field

View solution in original post

13 REPLIES 13
Drrickryp
Super User II
Super User II

Hi @Madumi 

I have been trying to do the same with a custom entity without luck.  The closest I came was to use the Last name field as the Primary Name field and create a calculated field for the full name by concatenating the first and last names.  As far as I can tell, you can't use a calculated field as a primary name field.   

thanks @Drrickryp 

 

Hmmm, that would be a pity indeed if it wasn't possible to do that.

 

Alternatively, can anyone think of a way to duplicate a current Entity (eg. "Contacts") with it's properties (maybe export & re-import somehow). Even if I could create a "Contacts 2" entity (with the "fullname" field, concatenated from first name and last name as a primary field), that would serve my purposes just as well...

Unfortunately there is no way to duplicate the functionality of the contact entity into a new custom entity. Other options are:

  • If you don't use the lead entity, you could repurpose that entity, as the primary field is fullname. However, this would prevent you from using the lead entity for it's normal purpose
  • Create a custom entity, and the name field as the primary field, and separate fields for first and last name. Create a real-time workflow (on Create, and Update of the first or last name fields) to populate the name field from the first and last name. The advantage of doing this rather than a calculated field is that you are populating the primary field

View solution in original post

v-xida-msft
Community Support
Community Support

Hi @Madumi ,

Do you want to create a Primary column "Full Name" within your Salespeople entity to act as the "Full Name" column in Contacts Entity (concatenated with First Name column and Last Name column)?

 

Based on the needs that you mentioned, I afraid that there is no way to achieve your needs in PowerApps currently. I agree with @DavidJennaway 's thought almost. You could consider create separated First Name field and Last Name field in your Salespeople entity (mark the two field as Required), and then rename the "Primary Name" field in your Salespeople entity into "Full Name".

When you create a new record in your Salespeople entity, you could consider design a Workflow to concatenate the "First Name" field value and "Last Name" field value, then populate the concatenated string value into the "Full Name" field.

 

If you generate a PowerApps app based on your Salespeople entity, and want to use PowerApps app to enter new record into your Salespeople entity, you could consider go to the Edit screen, then select the Edit form, then unlock the "Full Name" data card i your Edit form, set the Default property of the "Full Name" Text Input Box to following:

FirstNameTextBox.Text & " " & LastNameTextBox.Text

 then when you enter first name and last name within your form, the "Full Name" field would be populated with the concatenated value automatically.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks so much @v-xida-msft,

 

Where would I create a workflow like that? Is is a power automate (flow.microsoft.com)? or where?

 

Thanks also for the default property suggestion for a powerapp. That would overwrite the value for Full Name each time data was changed or entered in either First Name or Last Name right?

 

thx!

OK, I am currently trying to use Flows to update the primary field "Full Name" using the "First Name" and "Last Name" fields.

Sadly, I cant seem to find a way to trigger this operation, because the primary field is a required field. i.e. it cannot be saved/updated without content already present in the field.

 

I can see a way to do this within a powerapp form... However, is there a way to do this & populate the "Full Name" primary field using Flows and within the Salesperson CDS table itself?

 

Thanks!

Flow (Power Automate) is used for asynchronous operations. I'd recommend a synchronous workflow to set the fullname, which you can create in CDS.

You can also change the requirement level of the primary field. It is mandatory by default, but this can be changed

Thanks so much @DavidJennaway 

 

I'm just getting my feet wet here with CDS & powerapps...  Synchronous sounds good. Where would I achieve this (any hints on where I should be clicking/building)?

@DavidJennaway 

 

Thanks again for your suggestions. I can see a way to concatenate fields synchronously in CDS-->Flows-->New (instant, from blank). However if I am concatenating first, middle and last with a space between, it results in two spaces if the middle name is absent.

 

Do I need to use an expression (rather than dynamic content) to create the concatenation, & if so, how do I call an entity field (eg firstname) in the concat() expression? I can't seem to find the right way to call entity fields...

 

Thanks!

 

 

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (21,466)