Discussions

Expand all | Collapse all

Copy Master Detail records and then go to a PAGE and not to record?

QuickBaseCoach Dev./Training12-14-2016 12:20

  • 1.  Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-07-2016 09:45
    I have a button which creates tasks but when clicked I don't want it to go to the related project (which is standard) but instead to redirect to a Home Page.

    Currently the button is thus:

    "javascript:void(copyMasterDetailButtonHandler('&relfids=510&recurse=false&sourceRID=463&destrid=" & [Record ID#] & "', 'bjtdaeume'))"


    How can I get it to redirect to MYPAGE

    ??


  • 2.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-07-2016 15:14
    Mick,

    There is help in the API guide but basically you need to convert this to an a formula URL using an the CopyMasterDetail API, and then you can do successive actions.  ie do the copy and then redirect to show the dashboard.

    So it would be like 

    var text URLONE = urlroot() & "db/" & [_DBID_of the Parent table] & "?act=API_CopyMasterDetail&recurse=false&sourceRID=463&relfids=510";

    var text URLTwo = and here you need to hard code the main URL of the app.

    var text URLTWO = "https://mycompany.quickbase.com/db/abcdefg;

    $URLONE

    & "&rdr=" & URLEncode($URLTWO)


  • 3.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-07-2016 15:44
    Im getting the following when trying to save the formula url field?

    The argument list of the function rdr must begin with a left parenthesis.

    var text URLONE = urlroot() & "db/" & [_DBID_PROPERTIES] & "?act=API_CopyMasterDetail&recurse=false&sourceRID=463&relfids=510";

    var text URLTWO = "https://xxxxx.quickbase.com/db/xxxxxxxxx?a=showpage&pageid=30;

    $URLONE

    & "&rdr=" & URLEncode($URLTWO)


  • 4.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-07-2016 16:04
    ah, it needed a " after the 30

    But now its asking for apptoken.  Ive created one but I dont think I have it in the right place...

    var text URLONE = URLRoot() & "db/" & [_DBID_PROPERTIES] & "?act=API_CopyMasterDetail&recurse=false&sourceRID=463&relfids=510"&apptoken=apptoken;


  • 5.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-07-2016 16:06
    var text URLONE = URLRoot() & "db/" & [_DBID_PROPERTIES] & "?act=API_CopyMasterDetail&recurse=false&sourceRID=463&relfids=510&apptoken=apptoken";


  • 6.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-07-2016 17:27
    I had tried that as well but get this:

    <qdbapi>
    <action>API_CopyMasterDetail</action>
    <errcode>2</errcode>
    <errtext>Invalid input</errtext>
    <errdetail>CopyFID required</errdetail>
    </qdbapi


  • 7.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-07-2016 17:33
    try this change

    var text URLONE = URLRoot() & "db/" & [_DBID_PROPERTIES] & "?act=API_CopyMasterDetail&recurse=false&sourceRID=463&destrid=" & [Record ID#] & "&relfids=510&apptoken=apptoken";


  • 8.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-14-2016 11:38
    Sorry Mark, I have been away...  just tested that and it works a real treat...  THANKS!


  • 9.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 12-14-2016 12:20
    Great. Thx for letting me know.


  • 10.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 17:33
    Hi Mark,

    While creating child records, I also want to set some defaults value with this API call. I tried but could not succeed.

    Here is my formula:

    URLRoot() & "db/" & Dbid() & "?a=API_CopyMasterDetail&sourceRID=1&destrid=" & [Record ID#] & "&relfids=684"
    & "&_fid_76=" & "Not Required" 
    & "&_fid_77=" & "Not Required" 
    & "&_fid_78=" & "Not Required" 
    & "&_fid_79=" & "Not Required" 
    & "&_fid_80=" & "Not Required" 
    & "&_fid_81=" & "Not Required" 
    & "&_fid_82=" & "Not Required" 

    & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])

    Thanks,
    Gaurav Sharma


  • 11.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 17:38
    You cannot change field values with the CopyMasterDetail  API.    Its also not obvious to get at the rid for the newly created record. 

    What I do is to land the user on a report of recently created Parent records by the current user.  ie the records you just created.  I do that with an rdr after the copymasterdetail.

    I then detect that the name field for the record now begins with "copy of", and show a button and a big red message asking the user to put the button.  The button then makes any field changes required.


  • 12.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 17:48
    MS> You cannot  ...

    Here is my advice: If you have an rdr parameter in your formula URL you should be using script instead for the entire feature.


  • 13.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 17:51
    Dan, what is that script?

    Thanks,
    Gaurav


  • 14.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 17:53
    or can we use API_Editrecord with the CopyMasterDetail  API?


  • 15.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 17:54
    In order to edit a record, you need to know the record ID.  We don't, unless you go into a script solution.


  • 16.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 17:55
    GS> or can we use ..

    Why not? Has someone confined you to a room and prevented you from using those two methods together?


  • 17.  RE: Copy Master Detail records and then go to a PAGE and not to record?

    Posted 03-27-2017 18:14
    Yes.. You are right. I have tried to do the same but don't know what I am missing.

    My idea is that once the child records are created the, we can update those records from the parent record through the source record id.

    I am not sure whether it is the right way or not.

    Dan, if you can help me to that by natively or with the help of some script?

    Thanks in advance.

    Gaurav Sharma