Discussions

 View Only
  • 1.  Copy Record then edit orginal

    Posted 03-06-2019 12:05
    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#]

    &"&_fid_30=1"


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

    Any ideas?







  • 2.  RE: Copy Record then edit orginal

    Posted 03-06-2019 12:13
    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?


  • 3.  RE: Copy Record then edit orginal

    Posted 03-06-2019 12:22
    Not many,

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



  • 4.  RE: Copy Record then edit orginal

    Posted 03-06-2019 12:26
    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.


  • 5.  RE: Copy Record then edit orginal

    Posted 03-06-2019 12:30
    Thanks, how would I use API_GenAddForm as I have never used it before. 




  • 6.  RE: Copy Record then edit orginal

    Posted 03-06-2019 12:33
    I am also assuming I would have to link the fields to my original record somehow?


  • 7.  RE: Copy Record then edit orginal

    Posted 03-06-2019 14:00
    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.


  • 8.  RE: Copy Record then edit orginal

    Posted 03-06-2019 14:07
    ...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])



  • 9.  RE: Copy Record then edit orginal

    Posted 03-06-2019 14:28
    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.




  • 10.  RE: Copy Record then edit orginal

    Posted 03-06-2019 14:48
    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.