Forum Discussion

IanGrant's avatar
IanGrant
Qrew Trainee
20 days ago
Solved

Trouble with URL button to copy a record with custom GUID (key) field

Hi,
I'm trying to create a button that will allow users to copy a record but I'm using my own key field so I need to increment that automatically in the process.

Context: We have an online form for employees to created 'SDO Requests'. These get transferred from the resulting spreadsheet to a Quickbase 'helper' table where some transformations happen and a new GUID is assigned before a pipeline sends them to the master table. The custom GUID is necessary to weed out duplicate entries on import and transfer.

Since these requests involve dates and time periods they sometimes span two pay periods. I'm trying to provide the people that approve and audit the requests an easy way to 'split' a request by making a copy of the original so that they can just edit the end date of the original and start date of the copy (one day I'll dig into how to automate that as well since I have a table of pay periods to reference but I digress).

I have no idea if I'm even on the right path here but my thought was to pass the original GUID (e.g. key) field to the new record and just add the Quickbase generated Record ID# to the end of it to ensure a new unique value. I've tried variations of this:

URLRoot() & "db/" & Dbid() & "?a=GenCopyRecord&rid=" & [Record ID#]
& "&_fid_6=" & URLEncode([SDO Request GUID]&"-"&ToText([Record ID#]))

And so far I either get the same GUID as the original record or it momentarily populates the original GUID but goes blank (I suspect this is a result of me trying to add a concatenated value to the field. Fid_6 is the id of my GUID field.

URL coding is certainly not my strong suit in Quickbase to date so any help would be greatly appreciated. I'm not married to this idea either, I just need to be able to allow users to copy a record and generate any kind of new unique value for fid_6.

  • Unfortunately, the a=GenCopyRecord function does not allow you to specify values for any fields. It simply puts you into the Add record mode with fields copying forward where the field is flagged to copy forward on the field properties settings.  

    But instead, you could use this syntax

    URLRoot() & "db/" & dbid() &  "?act=API_GenAddRecordForm"

    & "&_fid_6=" & URLEncode([SDO Request GUID]&"-"&ToText([Record ID#]))

    & "&_fid_7=" & URLEncode([my field in field 7])

    & "&_fid_8=" & URLEncode([my field in field 8])

    & "&_fid_9=" & URLEncode([my field in field 9])

     

    .. So this is pretty easy to do except that you do have to specify every single field to be copied forward.

     

     

     

     

4 Replies

  • Unfortunately, the a=GenCopyRecord function does not allow you to specify values for any fields. It simply puts you into the Add record mode with fields copying forward where the field is flagged to copy forward on the field properties settings.  

    But instead, you could use this syntax

    URLRoot() & "db/" & dbid() &  "?act=API_GenAddRecordForm"

    & "&_fid_6=" & URLEncode([SDO Request GUID]&"-"&ToText([Record ID#]))

    & "&_fid_7=" & URLEncode([my field in field 7])

    & "&_fid_8=" & URLEncode([my field in field 8])

    & "&_fid_9=" & URLEncode([my field in field 9])

     

    .. So this is pretty easy to do except that you do have to specify every single field to be copied forward.

     

     

     

     

  • Thanks for the quick reply, Mark. I will give this a shot! Luckily, this particular table doesn't have a lot of fields so this wouldn't be overly tedious.

    Edit: Worked exactly as intended! Thanks so much!

  • Ian,

    How are you deduping requests?   I have a customer support request application that could use a feature like that.   Determining that new request is actually the same as a previous request is a challenge.

    • IanGrant's avatar
      IanGrant
      Qrew Trainee

      I wish I had a fancy all encompassing answer but it's pretty low tech. When data gets imported into the 'helper' table, there's a formula text field that puts together a couple of unique data points to give that request a unique ID. Last name, date of submission and time it was submitted (IIRC) are just combined into a value that looks something like Name-07162026-1559. This becomes the key field when it's transferred to the main table so records are merged on this field (so I don't have to worry about overlapping data when appending). It also means if something some how gets pushed again from that request, it will end up with the same ID and just update the existing record.

      If your problem is resubmitted customer requests and not straight up copies or  duplicates, you might be able to pull some different data points to form that unique field that would create a meta data of sorts for each record with which it can compare via query and flag if it finds a request from say for example, the same person with in the last 30 days under the same category. So that way even if the same person submits the request twice on purpose, it might help spot them.