TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Button position in Preview
Hi
Is there a way to have a button in a section rather than at the top of the preview please?
The application I am building requires a few buttons for data creation and I'd like to make them relevant to each section ..... any ideas please?

Thanks
Rebecca
ID
2060
Category
TeamDesk
Author

Rebecca Sell
Date Created
6/28/2024 6:58:26 AM
Date Updated
7/1/2024 1:18:22 AM
Comments
calvin peters 6/28/2024 8:49:26 AM
Try coding a FORMULA URL and setting the display property to BUTTON and placing that button wherever you need it inn your section.
Copy the URL from the custom button at the top that you want it to trigger then hide that custom button in it's property settings "Hidden".

The URL you need can be found in the DEV Console in the browser by right clicking the custom button you want to target...it'll be some HTML that looks like this:
<a href="/secure/db/"...yourdb#..."/edit.aspx?b=...your custom button id...&amp;id="...RecordId()..."&amp;back="...back URL..." title="...BUTTON TEXT..." data-form="frm_edit" class="ui-action ui-button v3-button ui-action-b...your custom button id...">...Display Text on Button..."</a>

So, in the URL the extensions that are important are
1) the "b=" >>>that the system Id for your button;
2)the "back=" which is the reverse navigation address for your URL that the "BACK" button in your pages use to navigate;
3) the RecordId(). This is NOT the record key but the value returned using the function RecordId(), a numeric root db needed for URL navigation.


The custom buttons are really nothing more than a URL and I've used this strategy quite a bit to do the same thing.


MF Builders 6/30/2024 4:08:55 PM
Could we get a visual example? It would be more concrete...
calvin peters 6/30/2024 11:59:50 PM
I have loaded up a sample app from the repository TD offers and made a simple update to help walk you through this if you wish.

I just need an email address to add someone as a user to give you the visual.

Essentially, the <a> tag from the dev console gets modified with URLEncode(RecordId()) to replace the navigational Id found in the custom button
The "&back=...some-gobble=de-gook..." gets replaced with ...' &back="&BackURL() '
So the formula URL end up looking something like this from the test app:
"https://www.teamdesk.net/secure/db/96383/edit.aspx?b=1831615&id="&URLEncode(RecordId())&"&back="&BackURL()

Where the button I created was saved and coded by TD as " b=1831615 "
The URL string is excaped after ' "id=" ' then insert ' &URLEncode(RecordID())& ' with both ampersands, one at each end...
Then restart the URL string with quotes like ' "&back=" ' and insert the function ' BackURL() ' to finish the string

RecordID() function will return the root row Id of the database record for whatever record the form is displaying at the time.
BackURL() function contstructs the back navigation string and places it at the end of the URL navigation string in your URL address bar based on whatever record the form happens to be displaying at the time.

The thing I had difficulty with, and still do sometimes, is remembering the extra ampersands that are required between string and function inserts...like the one after ' id="& ' and the double ampersand after the URLEncode()&"&back="&... Without those it just doesn't work...

So this will trigger the hidden custom button that I setup in this temporary app and when completed will return to the original record it started from...just like the Custom Navigation button that it is triggering was oded to do.

Shoot me an email here and I'll set it up as a user in this app if you need to see it work for clarity sake. I'm very much that way when it comes to understanding this stuff.

If you have it figured out from this explanation and don't need access. let me know here and I'll unload the app I modified.

Happy coding :)

calvin peters 7/1/2024 12:02:08 AM
*excaped...

it's late over here...please read as "escaped"...

...wow...
MF Builders 7/1/2024 1:18:22 AM
ok, yes would like to see more: andyzytas@outlook.com
Feedback
Back to Search Results