TIP: Using Deluge, create URL field with dynamic parameters such as record ID.

TIP: Using Deluge, create URL field with dynamic parameters such as record ID.

Using Deluge, create URL field with dynamic parameters such as record ID.
After reading dox and lotsa forum posts, here is what worked for us just now.  We're sorta new at this, maybe there are issues, or a better way.

Our purpose was, on the convenient "pop-up" page that can display when on a report you click on a linked item's name, to have a linked field at the bottom for "Edit This Record".  (A big convenience if you spot a need, you can edit it right away w/o going to a the different report and searching for that record.)  See the result in image at page bottom.



But useful also for anytime you need to create a link dynamically.

In this example:
* Form is "Contact"
* URL field Edit_this_Contact

Place the below into ON ADD:ON SUCCESS (since only needed on New records since the ID never changes, and ON SUCCESS since at this point the ID is known. Code:

  1. temp_param = input.ID.toString();
  2. input.Edit_this_Contact = "<a target='_blank' href='https://creator.zoho.com" + zoho.appuri + "Contact/record-edit/Contacts_List/" + temp_param + "/'>Edit</a>";

BUT in your app you probably want to point to another type of ID or other parameters, which could change when the record is edited.  So, place your code *also* in OnEdit:Validate.

Notes:
* Change the path so that it points to the same path as you get under the "Edit" link for your app.
* If later you change the form or report names etc. the link will probably not dynamically adjust the path.
* We hide the field from the form, OnLoad and OnEdit since user's don't need to see it.

To populate this field for all *existing* records, you'll need to create a custom function that performs the same, and run it once.  Use it also after importing, since during import, scripts are not triggered.
Function:
  1. void DATA_UPDATES.update_editcontact_link()
  2. // INITIAL USE: backfill values TO SUPPLY THE hidden "Edit Contact" link field
  3. // USE ALSO AFTER IMPORTING CONTACTS (since import does not trigger scripts)
  4. {
  5.     // I gave up after multiple tries to filter for empty/null URL field. So will update all.
  6.     for each MyRow in Contact  [ID > 0]
  7.     {
  8.         temp_param = MyRow.ID.toString();
  9.         MyRow.Edit_this_Contact = "<a target='_blank' href='https://creator.zoho.com" + zoho.appuri + "Contact/record-edit/Contacts_List/" + temp_param + "/'>Edit</a>";
  10.     }
  11. }

We cloned our normal report for a separate report, used only for the popup page, that has this field.

End result on the popup page:  see attached image.