cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Generating Autonumber from Canvas Apps when the primary field in CDS table is autonumber

I'm trying to generate Autonumber for the primary field in CDS Table, but the Defaults() doesn't do it for me when trying to create a record in the CDS Table as I get an error in Patch() that mandatory field is missing. Any workarounds here to generate the Autonumber from Canvas Apps?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Generating Autonumber from Canvas Apps when the primary field in CDS table is autonumber

Hi @Dchandna ,

 

If you want to generate autonumber for primary field, you should change the data type of primary field to Autonumber, and uncheck Required option.

Then you can use patch() and Defaults() functions to create a new record, the primary field would generate autonumber. Such as:

 

Patch(AutoNums,Defaults(AutoNums),{Title:"GG"})

Annotation 2019-10-04 151651.png

Best regards,

Sik

 

 

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Generating Autonumber from Canvas Apps when the primary field in CDS table is autonumber

Hi @Dchandna ,

 

If you want to generate autonumber for primary field, you should change the data type of primary field to Autonumber, and uncheck Required option.

Then you can use patch() and Defaults() functions to create a new record, the primary field would generate autonumber. Such as:

 

Patch(AutoNums,Defaults(AutoNums),{Title:"GG"})

Annotation 2019-10-04 151651.png

Best regards,

Sik

 

 

View solution in original post

Highlighted
Frequent Visitor

Re: Generating Autonumber from Canvas Apps when the primary field in CDS table is autonumber

Thanks didn't know primary field "required" can be unchecked in CDS

Highlighted
Helper III
Helper III

Re: Generating Autonumber from Canvas Apps when the primary field in CDS table is autonumber

Sik,

I was wondering if you could look at my post here:

CDS Question and Autonumbers

It appears to be the same problem and I unchecked "required", but I am not understanding how your code brings in the autonumber for the Entity.

 

Regards,

Jason

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,047)