Forum Discussion
AustinK
6 years agoQrew Commander
I think I saw another post about a similar thing somewhat recently.
The record ID is created once the record is created. You might be able to see what the most recent record id is and guess what the next would be but this will only work if you have a single person inputting records. If 2 people open the add form at one time(or another opens it before the first saves) then the next record id will be duplicated.
I'm not sure it is possible to grab the new record id via a button though.. Maybe with javascript there is a way. What are you trying to do exactly? That might help.
The record ID is created once the record is created. You might be able to see what the most recent record id is and guess what the next would be but this will only work if you have a single person inputting records. If 2 people open the add form at one time(or another opens it before the first saves) then the next record id will be duplicated.
I'm not sure it is possible to grab the new record id via a button though.. Maybe with javascript there is a way. What are you trying to do exactly? That might help.
RyanStanford1
6 years agoQrew Captain
Users create a record, and there is a pdf that will be created in the browser and will have fields mapped from the record into the pdf form. As the record will need to be saved prior to the pdf form being created, I need to execute a save.
The pdf is formed on a html code page, which the code page knows what value to grab because the RecID is sent as a parameter in the link.
------------------------------
Ryan Stanford
------------------------------
The pdf is formed on a html code page, which the code page knows what value to grab because the RecID is sent as a parameter in the link.
------------------------------
Ryan Stanford
------------------------------
- RyanStanford16 years agoQrew CaptainTo follow up on this as I've found a solution...
Part of the API_AddRecord response contains the new record ID.
I move the setting of the RedirectURL until after I get that response, populate appropriately, and then execute the redirect.
------------------------------
Ryan Stanford
------------------------------- AdamKeever16 years agoQrew Commander@Ryan Stanford how do you make that work?
------------------------------
Adam Keever
------------------------------- RyanStanford16 years agoQrew Captain@Adam Keever It's not specifically QB native, this is pretty much all JavaScript code, using the APIs to do what I want... So my method, is parsing the window.location, I'm able to determine if the current page is a Add/Edit record... if it's an Add record, before redirecting to the PDF creation code page (an html page), I first have the button click perform the AddRecord API call, with pertinent information from the form. With the response of that API call having the new RecordID#, I can then add that as a parameter in the redirect to the PDF page.
If it's an edit, desktop version has a global variable kRid, which is the Record ID of the page. Mobile app has a few alternatives depending on the page/form you're on.
------------------------------
Ryan Stanford
------------------------------