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

Using ID in a form

Hi, hope someone can help,

In order to make all my records unique I have adopted a job reference which incorporates the ID of the record as part of it.
I have a field in my form for job reference and it creates a value which consists of the record ID reference / the property address / our error code

What seems to be happening when I save the form is that the job refernace which should look something like 34/254/E5 is coming up as /254/E5 so the field is saving the value of the property address “245” and the error code “E5” but it seems to not be able to get the reference ID until after the record has been saved once using ‘SubmitForm’

Is this because the ID reference of the record isn’t issued until the form is saved?

Once the form is saved you can see the full reference in the files, but you have to press save again so that it writes it too the data source.

I have tried SubmitForm(formname);SubmitForm(Formname) but I just get an error.

Is there a way to update the record, before the form is submitted so that the job reference is written to the data source correctly first time?

Sorry if this doesn’t make clear sense, found it hard to explain what I’m trying to achieve!

Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Using ID in a form

@d3ell 

 

Is this because the ID reference of the record isn’t issued until the form is saved?

Yes, that is exactly why.  An ID is not issued until the record is created.

What you can do easily is just adjust your submit to something like the following:

 

SubmitForm(FormName); Patch(yourDataSource, FormName.LastSubmit, {jobReferenceField: FormName.LastSubmit.ID & FormName.LastSubmit.jobReferenceField})

This will prepend the last submitted jobReferenceField value ("/254/E5" in your example) with the ID ("34" in your example.  Result is what is desired.

 

Give it a shot and I hope it helps.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Using ID in a form

@d3ell 

 

Is this because the ID reference of the record isn’t issued until the form is saved?

Yes, that is exactly why.  An ID is not issued until the record is created.

What you can do easily is just adjust your submit to something like the following:

 

SubmitForm(FormName); Patch(yourDataSource, FormName.LastSubmit, {jobReferenceField: FormName.LastSubmit.ID & FormName.LastSubmit.jobReferenceField})

This will prepend the last submitted jobReferenceField value ("/254/E5" in your example) with the ID ("34" in your example.  Result is what is desired.

 

Give it a shot and I hope it helps.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
d3ell
Level: Powered On

Re: Using ID in a form

Thank you that has worked !

 

Much appreciated! 🙂

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,111)