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
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 (8,684)