cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Caroline
Level: Powered On

PowerApp doesn't autogenerate PrimaryName value when submiting new form

Since the Upgrade to CDS v2, I haven't been able to save new data from the PowerApp, as the Primary Name field in the CDS doesn't autogenerate.

I don't have this problem when I submit new data by opening in excel and using the connector.

 

I have tried the following formula from @Shanescows YouTube video on generating an autonumber, but it returns an error sating invalid argument type (GUID). Expecting table value instead. 

 

If(NewNotesForm.Mode = FormMode.New, Last('learner notes').cr96a_primaryname + 1,Parent.Default)

 

'learner notes' = entity name

cr96a_primaryname = field name

 

I have also tried changing the primary name field in the CDS from autonumber to text, but get the same error.

Any ideas?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

Hi Caroline!

 

There is no reason to why the the entity name does not appear in the drop down. This is happening because the canvas app is not connected to the particular CDS data table. I would suggest you to do the following: 

Go to View -> Data Sources -> Add a Data Source -> New Connection -> CDS -> select the entity from here. Post this, you should be able to access the entity. 

 

Please note that you will not need to put the entity name in single quotes. If you are not able to find the entity in drop down simply add a new conection to that data table. 

 

Also, selecting 'Last (entityname)' will give you an error as this will always return a GUID (ID of the Record as a lookup) so you will have to add the field in front of it. 

 

Hope this helps. 

 

Thanks. 

 

7 REPLIES 7
Super User
Super User

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

Hey!

 

One way of doing this could be making the cr96a_primaryname field as required. On the canvas app form, set the value of this as default to the following formula :

Last(TestYAS).Name + 1

here, TestYAS is the entity name and Name is the primary field of the entity which has been set to autonumber custom and form as sequential and is set to required (please check the screenshot below): 

papspsp1.png

Power Apps Form: 

jkjkj.png

Also, I noticed that you are using the entity logical name in the formula for powerapps, please not that you need to put the display name over there (just select from the drop down while typing the formula)

 

Thanks, 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Caroline
Level: Powered On

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

@yashag2255 thanks for the suggestion. I have the primary name set as required, and an autonumber. It seems to be the entity name that the formula isn't accepting. I have selected it from the list, but it imediately gives the same error message.

Capture.JPG

 

Super User
Super User

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

Hi, 

 

Can you share a screenshot of the field configuration from CDS. Also, can you please complete the formula and post the screenshot of the error highlighting the error in this context only?

 

 

Thanks, 

 

Caroline
Level: Powered On

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

@yashag2255

 

Interestingly, I haven't been able to change the autonumber type in the PrimaryID field, but as the prefix isn't required, that shouldn't affect this issue. I also don't get a drop-down suggesting field names when I write the formula, which to me also suggests it's the entity name that is the problem, even though that was selected from the drop-down. Cheers.

 Capture_1.JPGPrimary Name field in CDS entity 

Capture_2.JPGDefault Formula in app

Caroline
Level: Powered On

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

@yashag2255After some playing around, I have been able to get it to work with some entities within the same app, but not others.

I also don't get a drop-down suggesting field names when I write the formula, which to me also suggests it's the entity name that is the problem, even though that was selected from the drop-down. The screen shot shows that it is the entity name in the Last formula that isn't working, but as far as I can see, there is no difference between the one that works and the one that doesn't.

DefaultValue accepted.JPGAccepted default valueDefaultValue_not_accepted.JPGDefault value with errorEntityField_not_accepted.JPGEntitly field connected to the data card with the errorEntityField_accepted.JPGEntitly field connected to the data card that has no error

  I can't see why it would work in some instances and not others. (For the record, I note that one has a minimum number of 3 digits, and the other 4, but that doesn't affect it.)

 

Highlighted
Super User
Super User

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

Hi Caroline!

 

There is no reason to why the the entity name does not appear in the drop down. This is happening because the canvas app is not connected to the particular CDS data table. I would suggest you to do the following: 

Go to View -> Data Sources -> Add a Data Source -> New Connection -> CDS -> select the entity from here. Post this, you should be able to access the entity. 

 

Please note that you will not need to put the entity name in single quotes. If you are not able to find the entity in drop down simply add a new conection to that data table. 

 

Also, selecting 'Last (entityname)' will give you an error as this will always return a GUID (ID of the Record as a lookup) so you will have to add the field in front of it. 

 

Hope this helps. 

 

Thanks. 

 

Caroline
Level: Powered On

Re: PowerApp doesn't autogenerate PrimaryName value when submiting new form

@yashag2255 thanks for all your help andclear explainations. Re-connecting to the entity seemed to have fixed it.