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

Generating a Unique Name for a Form field with a convention

Hi Team,

 

I wanted to ask for your support in finding a way to generate a naming conventions for a PowerApp Form. 

I need each form to have a unique name that follows a convention and that is consecutive for example there is a field in the form that is called "Request Number". I would need this field to retun back a automatically generate unique code that follows this format: PACFORM-######, in which the number (#) is a consecutive number (i.e. PAC-000001 than the following form submitted will have PACFORM-000002) for each of the forms submitted. 

 

Hope to hear back.

 

-Daniel  

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Generating a Unique Name for a Form field with a convention

Hi @DanMuriel 

 

You could use the SharePoint ID column as a reference

 

Once you submit/post form data to sharepoint

you can use the onsuccess property to fetch the ID value of the last submitted item

 

Form.LastSubmit.ID - you can get this in the onsuccess property of your form control

 

and then patch the same item in the onsuccess property

 

PACFORM-ID

and so on

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Dual Super User
Dual Super User

Re: Generating a Unique Name for a Form field with a convention

Hi @DanMuriel 

 

You could use the SharePoint ID column as a reference

 

Once you submit/post form data to sharepoint

you can use the onsuccess property to fetch the ID value of the last submitted item

 

Form.LastSubmit.ID - you can get this in the onsuccess property of your form control

 

and then patch the same item in the onsuccess property

 

PACFORM-ID

and so on

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

DanMuriel
Level: Powered On

Re: Generating a Unique Name for a Form field with a convention

Hi @RezaDorrani 

 

Thank you for your response, I was trying create the patch on the OnSuccess Field on form but have an problem. 

 

This is the what I am typing in the field: 

 

Patch(PAC_List, Defaults(PAC_List),{Title: "PAC-Form-" & PAC_FORM_MAIN.LastSubmit.ID})

 

In the submit button I have a general SubmitForm(PAC_FORM_MAIN)  I have also tried putting the Patch in the submit button but the lastsubmit.ID is not populating in the field. 


@RezaDorrani wrote:

Hi @DanMuriel 

 

You could use the SharePoint ID column as a reference

 

Once you submit/post form data to sharepoint

you can use the onsuccess property to fetch the ID value of the last submitted item

 

Form.LastSubmit.ID - you can get this in the onsuccess property of your form control

 

and then patch the same item in the onsuccess property

 

PACFORM-ID

and so on

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly



@RezaDorrani wrote:

Hi @DanMuriel 

 

You could use the SharePoint ID column as a reference

 

Once you submit/post form data to sharepoint

you can use the onsuccess property to fetch the ID value of the last submitted item

 

Form.LastSubmit.ID - you can get this in the onsuccess property of your form control

 

and then patch the same item in the onsuccess property

 

PACFORM-ID

and so on

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly



Any suggestions? 

 

But when I test it out I get an error message 

Dual Super User
Dual Super User

Re: Generating a Unique Name for a Form field with a convention

Hi @DanMuriel 

 

OnSuccess property Patch function should look like

 

Patch(PAC_List, PAC_FORM_MAIN.LastSubmit,{Title: "PAC-Form-" & PAC_FORM_MAIN.LastSubmit.ID})

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (7,985)