Copy Record then edit orginal

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
I am trying to use a button to copy a record and then change a field in the original.

I have typed in exactly the below (apart from the dbid being XXX) into the field formula which is a URL Formula field:

URLRoot()&"db/XXX?a=GenCopyRecord&rid="&[Record ID#]


The button will copy the record fine but wont set the checkbox in field 30 to be checked?

Any ideas?

Photo of Chris Green

Chris Green

  • 124 Points 100 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
You an get that to work if you populate every field and use API_GenAddForm.

But I know if there are a ton of fields, that is a pain. How many fields would you need to populate?
Photo of Chris Green

Chris Green

  • 124 Points 100 badge 2x thumb
Not many,

I have 
  • 1 date
  • 2 DropDowns
  • 1 Notes
  • 1 checkbox (fid_30)
  • 3 related fields

Then just do it that way.

I would visually line up all the part of the formula which are populating each field, vertically, for readability.

If you had say 50 fields, plan B is to use copy master detail and the

There is a cheat to get it to just copy the parent, then use an Automation or Action to edit the record, but that would be overkill complexity for your needs.
Photo of Chris Green

Chris Green

  • 124 Points 100 badge 2x thumb
Thanks, how would I use API_GenAddForm as I have never used it before. 

Photo of Chris Green

Chris Green

  • 124 Points 100 badge 2x thumb
I am also assuming I would have to link the fields to my original record somehow?
Or use a redirect command to "Chain" multiple API's, editing the source record to check the box first, then copying it. 

Something Like this should work.....

// 1. Checks the box on the Source record being copied

        URLRoot() & "db/" & "_________" & "?a=API_EditRecord&rid=" & URLEncode ([Record ID#]) 
        & "&_fid_30=true&apptoken=_____________________&rdr=" 

// 2. The RDR above cycles to a second API Call type to copy that same source record...

URLRoot()&"db/"________?a=GenCopyRecord&rid="&[Record ID#]

You could also solve for this with actions or automations, which are a bit more user friendly. Depending on the use-case, checking the box on the source record and saving could be used as an "Automation" trigger that copies the values from that record to another, but the API route is a bit more elegant IMO.
...but Chris may not want the original record checkboxed.

Chris, the format for the GenAddRecordForm is the same as you see in any native Add Record button.

URLRoot() & "db/" & [_DBID_xxxx] & "?act=API_GenAddRecordForm"
& "&_fid_7=1" // check box true
& "&_fid_8=" & ToText(Today()); // set this field to Today
& "&_fid_9=" & URLEncode("some text here that might have spaces or special characters")
& "&_fid_10=" & ToText([Related Parent 1])
& "&_fid_11=" & ToText([Related Parent 2])

That's true. I did make the mistake of assuming the "1" represented a checked box on the original, but the recommendation would work even if the field weren't a checkbox. Your approach is a sound
suggestion as well.

Oh, you are correct.  I misread the question.  Chris is trying to flag the original record as having been copied.

Chris post back if you get stuck trying to string that together.