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

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
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

Photo of Michael Graham | Insight Global UK

Posted 3 years ago

  • 0
  • 1

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 = ";


& "&rdr=" & URLEncode($URLTWO)
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 = ";


& "&rdr=" & URLEncode($URLTWO)
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;
var text URLONE = URLRoot() & "db/" & [_DBID_PROPERTIES] & "?act=API_CopyMasterDetail&recurse=false&sourceRID=463&relfids=510&apptoken=apptoken";
I had tried that as well but get this:

<errtext>Invalid input</errtext>
<errdetail>CopyFID required</errdetail>
try this change

var text URLONE = URLRoot() & "db/" & [_DBID_PROPERTIES] & "?act=API_CopyMasterDetail&recurse=false&sourceRID=463&destrid=" & [Record ID#] & "&relfids=510&apptoken=apptoken";
Sorry Mark, I have been away...  just tested that and it works a real treat...  THANKS!
Great. Thx for letting me know.
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#])

Gaurav Sharma
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.
Dan, what is that script?

or can we use API_Editrecord with the CopyMasterDetail  API?
In order to edit a record, you need to know the record ID.  We don't, unless you go into a script solution.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
GS> or can we use ..

Why not? Has someone confined you to a room and prevented you from using those two methods together?
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