Forum Discussion

IvanWeiss's avatar
IvanWeiss
Qrew Captain
6 years ago

API Button is exposing xml instead of redirect

Hi everyone

For some reason this API button is not processing the rdr and returning to display the record.  It is exposing the xml results.

I am sure I am overlooking something simple but cannot find it.

Thanks!

------------------------------
Ivan Weiss
------------------------------
  • Post your formula; it's likely a syntax error.

    ------------------------------
    Laura Thacker (IDS)
    laura@intelligentdbs.com
    (626) 771 0454
    ------------------------------
    • IvanWeiss's avatar
      IvanWeiss
      Qrew Captain

      Sums up my day!  Forgot to paste in the formula!

       

      //Button Functionality:

      //Change the stage of the opportunity to won and set the Date Won to Today.  This triggers automation.

      //Redirect back to the same form to display the record with updates.

      //**************************************************************************************************************

       

      //Define button style

      var text CLASS = If([Stage]="Won","btn btn-success btn -sm","btn btn-default btn -sm");

      var text FONTCOLOR = If([Stage]="Won", "#FFFFFF", "#A9A9A9");

      var text LABEL = "Won";

       

      //Change the stage of the opportunity to won and set the date won to today.

      var text URLONE = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

                                  "&rid=" & [Record ID#] &

                                  "&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8" &

                                  "&_fid_9=Won" &

                                  "&_fid_23=" & URLEncode(Today()) &

                                  "&rdr=" & URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

                                  

      "<a class='" & $CLASS & "' style='color: " & $FONTCOLOR & "; text-decoration: none'" & "href='" & $URLONE & "'" & ">" & $LABEL & "</a>"

       

      Ivan J. Weiss, CFSP | Executive Vice President & COO | elite|studio e

      631.949.6635 | www.elitestudioe.com

       

      Connect with us. LinkedIn | Instagram

       



      ------Original Message------

      Post your formula; it's likely a syntax error.

      ------------------------------
      Laura Thacker (IDS)
      laura@intelligentdbs.com
      (626) 771 0454
      ------------------------------
      • LauraThacker's avatar
        LauraThacker
        Qrew Captain
        URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8&rid=" & [Record ID#]
        & "&_fid_9=" & URLEncode("Won")
        & "&_fid_23=" & URLEncode(Today()) 
        & "&rdr=" & URLEncode(
        URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])​


        ------------------------------
        Laura Thacker (IDS)
        laura@intelligentdbs.com
        (626) 771 0454
        ------------------------------
    • IvanWeiss's avatar
      IvanWeiss
      Qrew Captain

      Thanks!  That did it.  Those URL Encodes still get me, I cant figure out the consistent rules to them

       

      Ivan J. Weiss, CFSP | Executive Vice President & COO | elite|studio e

      631.949.6635 | www.elitestudioe.com

       

      Connect with us. LinkedIn | Instagram

       



      ------Original Message------

      Post your formula; it's likely a syntax error.

      ------------------------------
      Laura Thacker (IDS)
      laura@intelligentdbs.com
      (626) 771 0454
      ------------------------------
      • LauraThacker's avatar
        LauraThacker
        Qrew Captain
        Strongly recommend the Magic Buttons application in the Exchange - this will give you huge insights to formatting of formulas; especially when the Quick Base format is new to you.

        Remember on redirects you have to URLEncode() the redirect location otherwise the formula doesn't know what to do after the initial API action.

        ------------------------------
        Laura Thacker (IDS)
        laura@intelligentdbs.com
        (626) 771 0454
        ------------------------------