Forum Discussion

AJCampani's avatar
AJCampani
Qrew Cadet
5 years ago

Is it possible to have a copy parent record button also make changes to some fields?

I have a Tenants table that is the parent of a Leases table. I used the wizard in app management to create a Copy Lease button (which I renamed "Assign Lease"). However, what I want is when the Assign Lease button is clicked, for it to automatically check a checkbox field called "Lease Assigned" in the original Lease record and permit the user to choose a different existing parent record for the newly created/copied Lease record.

So for example, a user might be in a Tenant record for Tenant A, clicks the Assign Lease button and then the record for Tenant A is saved with the Lease Assigned field checked, and the user then selects Tenant Q as the parent for the newly created/copied Lease record and saves. 

I've seen some examples of formula url buttons that change data in fields but I don't kn ow how to combine that with the copy record button created by the wizard. Any guidance would be greatly appreciated!

AJ

------------------------------
Albert Campani
------------------------------
  • The wizard uses an API which will copy all fields. there are no parameters to change that  


    So Plsn B is to have a button for the user to push when the record identifier field begins with the word Copy of to clear out the field and say leave the user in edit mode 

    You could use a form rule to hide sections of the form when the name begins with Copy Of  

    post back if you need help with the button formula  


     




    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • AJCampani's avatar
      AJCampani
      Qrew Cadet
      Yes please I would appreciate help with it.

      ------------------------------
      Albert Campani
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        OK here goes,

        We need to make a URL formula field to edit the record and land the user in edit mode on the record.

        When using API's which update records, we either need to have what is called an application token.
        You may or may not want to keep the need for those enabled those enabled. many of my clients choose to disable the need for them.  That is a setting on Application Properties for the App settings.

        Here is the code for a button. Post back with your code and any error messages as I'm free form typing this without the benefit of he formula syntax editor!

        You can get the field ID# by right clicking a field name on the form or looking at the field properties under Usage or in the URL. 


        // this is a comment
        //this is a formula variable below

        var text ClearFields = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
        & "&apptoken=cxcxcxcxcxcxccxcxcxxcxc" // insert your app token here is you have them enabled
        & "&_fid_90="  // clear field ID 90 change the 90 to the field ID# of your own fields. 
        & "&_fid_91="  // clear field ID 91
        & "&_fid_92="  // clear field ID 92
        & "&_fid_93=";  // clear field ID 93  and end the formula variable with a semi colon

        // new formula variable to display the record in edit mode.
        var text DisplayInEditMode = URLRoot() & "db/" & dbid() & "?a=er&rid=" & [Record ID#];

        $ClearFields
        & "&rdr=" & URLEncode($DisplayInEditMode)

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------