This XML file does not appear to have any style information associated with it. The document tree is shown below.

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered

Below is my URL formula ...


URLRoot()& "db/" &Dbid()& "?a=API_CopyMasterDetail" &

"&relfids=38" &

"&sourceRID=159" &

"&destrid="& [Record ID#];


Records copy, but when I click the button for copying the detail records I receive the XML File with the following data:


<qdbapi> <action>API_CopyMasterDetail</action> <errcode>0</errcode> <errtext>No error</errtext> <parentrid>3</parentrid> <numCreated>3</numCreated> </qdbapi>
Any help is appreciated!
Photo of Andrew

Andrew

  • 0 Points

Posted 4 years ago

  • 0
  • 1
Anytime you do a URL formula which edits or adds a record, you need to the redirect to display a record or a report as the next action, or else the API not so subtly reports its success or failure back to you.

If you want to next reDisplay the Original Record, and for some reason you want to use the aPI method, it would be like

var text URLONE = the code you had above ending in semicolon;

var text URLTWO =

URLRoot()& "db/" &Dbid()& "?a=API_EditRecord" &

"&rid=" & [Record ID#]&

"&_fid_42=1";



var text URLTHREE = urlroot() & "db/" & dbid() & "?a=dr&rid=" & totext([Record ID#]);

$URLONE
& "&rdr=" & urlencode($URLTWO)
& URLENCODE ("&rdr=" & urlencode( $URLTHREE))
I edited my answer above to take into account your full question including your other post.
Photo of Andrew

Andrew

  • 0 Points
Perfect .... thanks for your help Mark - much appreciated as usual.  Any idea where I can get some more specific directions regarding how to compile URL formulas? The API Documentation is good, but it doesn't do a very good job of explaining the nuances for the newbies like me.
There is an app I put in the Exchange called URL Formuals for Dummies.  The cover page has a bit of tutorial on how to nest the URLs for successive actions.  Have a read of that, and then you can post back with any questions or just contact me via my Profile info.
Photo of Andrew

Andrew

  • 0 Points
Mark - now I want to add a statement to check if the checkbox is false, and if it is, execute the URL fomula above, otherwise, respond with a message that the detail records have already been copied, and return to the form and do nothing. Possible?
We are starting to get out of my comfort zone but this might work

var text URLnull="xx";

if([checkbox field]=true,

"javascript:" &
"$.get('" &
$url &
"',function(){" &
"$.jGrowl('Warning! You have already Imported Standard detail records.', {life: 5000});" &
"});" &
"void(0);",

$URLONE
& "&rdr=" & urlencode($URLTWO)
& URLENCODE ("&rdr=" & urlencode( $URLTHREE)) )

But another way to go is simply this

if([checkbox field]=false,
$URLONE
& "&rdr=" & urlencode($URLTWO)
& URLENCODE ("&rdr=" & urlencode( $URLTHREE)) )

if you do that and the checkbox is true (ie already imported) , then the formula is null and the button will be blank with nothing to click on.
Photo of Robert

Robert

  • 30 Points
Could I instead redirect to the new record somehow?
Photo of iris panabaker

iris panabaker

  • 80 Points 75 badge 2x thumb
You can use these XML tools to work with XML

  1. XML Viewer
  2. XML Formatter