Copying record data between documents with remote scripts

I already showed one example using the clipboard to exchange data between two Tap Forms documents. Now there is a second way using script URLs:


And in the target script ‘Test Script’, the parameters dictionary object contains the provided values:


It is important that all option variables and their content is properly encoded so that no special characters break the URL handling. To simplify this, I use a few helper functions:

// Fix special characters that are not encoded by encodeURIComponent: [!'()*]
function fixedEncodeURIComponent(str) {
  return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
    return '%' + c.charCodeAt(0).toString(16);

// Encode a given dictionary to create an encoded parameter string used
// with an URL.
function encodeUrlParameters(params){
   let p = [];
   for (var key in params){
      let value = params[key];
      // ignore parameters without value
      (value)? p.push(encodeURIComponent(key) + "=" + fixedEncodeURIComponent(value)): null;
      console.log("params[" + encodeURIComponent(key) + "] = " + fixedEncodeURIComponent(value));

   return p.join('&');

// Create a properly format script URL including encoding special characters where needed
function createScriptUrl(documentDb, formDb, scriptName, parameters){
   let url = "tapformz://script/" + documentDb + "/" + formDb + "/" + fixedEncodeURIComponent(scriptName) + "?" + encodeUrlParameters(parameters);
   return url;

Now, all I have to do is useĀ ‘createScriptUrl(…)’ to prepare the script URL

This example show how to call ‘My Script’ with a few parameters:

let url = createScriptUrl("db-xxx", "frm-xxx", "My Script", {a: "alpha", b: "beta", c: "gamma"});

This second example captures all fields of a record together with the assigned values and sends them to the target script:

var params = {};
for (field of form.getFields()){
	params[] = record.getFieldValue(field.getId());

Utils.openUrl(createScriptUrl("db-xxx", "frm-xxx", "create Record", params));

Using script URLs, it is now very easy to send data to a Tap Forms document. App-to-app communication opens the door for many workflow improvements. And as shown here, this can be done within Tap Forms as well.

Did you like this post? Did you use the given code? Please consider supporting me by buying me a coffee!

Buy Me A Coffee


Leave a Reply

Your email address will not be published. Required fields are marked *

Web Design Consulting

Do you need help designing your web site or getting Backlight working the way you want? Contact me to discuss your idea or project.

Buy me a Coffee

If you like what I share here, please consider buying me a coffee or a print. This helps keeping me motivated to continue posting. Thank you!

Buy Me A Coffee