cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
d3ell
Helper V
Helper V

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
RandyHayes
Super User
Super User

@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 below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@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 below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you that has worked !

 

Much appreciated! 🙂

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,750)