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:
- temp_param = input.ID.toString();
- 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:
- void DATA_UPDATES.update_editcontact_link()
- // INITIAL USE: backfill values TO SUPPLY THE hidden "Edit Contact" link field
- // USE ALSO AFTER IMPORTING CONTACTS (since import does not trigger scripts)
- {
- // I gave up after multiple tries to filter for empty/null URL field. So will update all.
- for each MyRow in Contact [ID > 0]
- {
- temp_param = MyRow.ID.toString();
- MyRow.Edit_this_Contact = "<a target='_blank' href='https://creator.zoho.com" + zoho.appuri + "Contact/record-edit/Contacts_List/" + temp_param + "/'>Edit</a>";
- }
- }
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.