Rich text formula link in an email to update a record and redirect to a page

  • 0
  • 1
  • Question
  • Updated 3 months ago
  • Answered
I am trying to setup a link in a notification to update a record and redirect to a page...I have used the code below in another app but for some reason when I click on the link, it is taking me to an XML output instead of the notification page

What am I missing?


Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb

Posted 3 months ago

  • 0
  • 1
You might try doing a url encode on the rdr. Also looks like you've got an extra single quote and space in the secondary url between the rdr= and http that should be removed 

So ... your string would end with:   

[Record ID#] & "&rdr=" & URLEncode("https://...") & "'>Click Here...


Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base
Joey,
If you post your code we can correct it.  It's really hard to read or correct a screen shot.
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb
Ok, what Chayce provided above worked except I need to pass the Record ID in the redirect URL

This is what I tried but is giving me an error

"<a href='https://my.quickbase.com/db/xxxxxx?act=API_EditRecord&usertoken=my_user_token&apptoken=my_ap...; & URLEncode("https://my.quickbase.com/db/xxxxxx?a=showpage&pageID=53"&[Record ID#]&")&"'>Click Here To Decline</a>"

Basically this redirect is taking me to a page to enter a reason of Decline and that is entered on the record...this is the need to pass the RID in the redirect
What is on that page?? 53
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb

This is the code in the redirect page....you enter a reason of decline and that gets posted back to the record, that is why I need to pickup the record ID in the redirect


<form name=qdbform method=POST onsubmit='return validateForm(this)' encType='multipart/form-data' action=https://my.quickbase.com/db/xxxxx?act=API_EditRecord&usertoken=my_user_token&apptoken=my_app...;

<input type=hidden name=fform value=1>

<center><table>

<center>Billing Review Declined Reason</center>

<tr><td class=m><textarea  name=_fid_207 rows=6 cols=60></textarea></td></tr>

</table><input type=hidden name=rdr value='https://my.quickbase.com/db/xxxxxx?a=dbpage&pageID=53'></center>;

<input type='hidden' name='rid' id='rid'/>

<center><input type=submit value=Save></center>

</form>

 

<script lang="javascript">

function getUrlVars() {

    var vars = {};

    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {

        vars[key] = value;

    });

    return vars;

}

 

 

function getUrlParam(parameter){

    var urlparameter = '';

    if(window.location.href.indexOf(parameter) > -1){

        urlparameter = getUrlVars()[parameter];

        }

    return urlparameter;

}

 

var recordId= getUrlParam('rid');

 

var ridElement = document.getElementById('rid');

ridElement.value = recordId;

 

function CheckForOther (item, origlen)

                {

                var sitem = item.options[item.selectedIndex];

 

                if (item.selectedIndex == (item.length - 1))

                                {

                                var val = prompt ("ADD A NEW CHOICE:", "");

 

                                if (val == null)

                                                item.selectedIndex = 0;

                                else       

                                                {

                                                var slen = item.length;

 

                                                if (slen == origlen+1){

                                                                item.options[slen] = new Option (sitem.text, sitem.value);

                        }

                                               

                                                item.options[item.length-2].text = val;

                                                item.options[item.length-2].value = val;

                                                item.selectedIndex = item.length-2;

                                                }

                                }

                }

</script>

<script lang=javascript>

function validateForm(theForm)

{

}

</script>
If you're intent on using a code page - looks like your window.location parsing is missing something. You need to actually split out the parameter using a "&" and parameter name like below

So your actual redirect link would be like realm.quickbase.com/db/dbid?a=dbpage&pageid=2&recordid=12345 

and then grab the window.location and grab the value that appears after your recordid parameter. 

Another option using standard quick base if you're just trying to grab a secondary user entry is to set up a secondary quick base form that only has those fields on there. So instead of redirecting to a script page you could redirect to a form like: 

realm.quickbase.com/db/dbid?a=er&rid=12335&dfid=10 

Where dfid=10 is an alternate Quick base form in that table with just those fields on it


Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb
This is all working in another app, the difference between this app and that one is how the code for the redirect is being done. So how do I add the Record ID to this

URLEncode("https://my.quickbase.com/db/xxxxxx?a=showpage&pageID=53"&[RecordID#]&")&"'>Click Here To Decline</a>"


The URL would look like this in my experience-
"https://my.quickbase.com/db/xxxxxx?a=showpage&pageID=53&rid=" & [Record ID#]
 
The &rid= after 53 is what I added
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb
Yeah, that is not working either, it is not passing the rid to the redirect page. I am not figuring out why it works in my other app but not here other than how the redirect url is coded between the two.
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb
Just wanted to follow up and let you know that I got it working....one little mistake

On the URL redirect I have showpage&pageID instead of dbpage&pageID

From this

https://my.quickbase.com/db/xxxxxxx?a=showpage&pageID=53&rid="&[RecordID]&...;

To this

https://my.quickbase.com/db/xxxxxxx?a=dbpage&pageID=53&rid="&[RecordID]&...;

Sorry about not catching that - I typed that in one of my original responses but then copied and pasted after. Showpage will be for normal dashboard pages, dbpage will be how you actual invoke a code page when you open the URL. Glad you got it working though.



Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base