Forum Discussion

Re: Rich Text Formula Field for Approve / Reject button and redirection

Thanks to your help, I'm super close to where I want to be! Here is my code for the rich text field that I created, all is well, except for the last redirect for the approved button. I highlighted in bold, QB is throwing an "expected text" syntax error.

I tried to follow your convention above, but have been scratching my head over it for an hour now..



var text approve =  URLRoot() & "db/" &  [_DBID_] & "?a=API_EditRecord&apptoken=xxxxx&rid=" & URLEncode ([Record ID#])
& "&_fid_12=" & URLEncode("Approved")
& "&_fid_13=" & URLEncode(Now())
& "&_fid_14=" & URLEncode(User())
& "&rdr=" & URLEncode(URLRoot() & "db/xxxxx?a=API_EditRecord&apptoken=xxxxxxx&rid=" & URLEncode ([Related Store Item])
& "&_fid_14=" & URLEncode([# of Features Requested]));
& URLEncode("&rdr=" & URLEncode(URLRoot() & "db/xxxxx?a=dr&rid=" & ([Record ID#]));

var text reject =   URLRoot() & "db/" & [_DBID_] & "?a=API_EditRecord&apptoken=xxxxxxx&rid=" & URLEncode ([Record ID#])
& "&_fid_12=" & URLEncode("Rejected")
& "&_fid_13=" & URLEncode(Now())
& "&_fid_14=" & URLEncode(User())
& "&rdr=" & URLEncode(URLRoot() & "db/xxxxxx?a=dr&rid=" & ([Record ID#]));

var text cancel =    URLRoot() & "db/" & [_DBID_] & "?a=API_EditRecord&apptoken=xxxxxxx&rid=" & URLEncode ([Record ID#])
& "&_fid_12=" & URLEncode("Cancelled")
& "&_fid_13=" & URLEncode(Now())
& "&_fid_14=" & URLEncode(User())
& "&z=" & Rurl();


//Colors of the buttons. The second color is the mouseover color.
var text buttoncolor= "@#76c043@#367c2b@";
var text buttoncolortwo= "@#c04e43@#89362e@";


var text buttoncolorthree= "@#efab49 @#a96a0f@";

var text buttonone= $approve & $buttoncolor & "Approve";
var text buttontwo= $reject & $buttoncolortwo & "Reject";
var text buttonthree= $cancel & $buttoncolorthree & "Cancel";

var bool ShowButtonOne = If(Now()>[Date Created], true, false);

// ========================Begin Pattern========================

var text onclickone =  "\" onclick=\"LinkAway('";
var text onclicktwo = "', false); return false;\"";

//Button bar
If($ShowButtonOne=true,
"<div style=\"position:relative; width: 330px; height: 25px; \">" & 
If($buttonone<>"", "<a href=\""  & Left($buttonone, "@") & $onclickone & Left($buttonone, "@") & $onclicktwo & "\" style=\"color:white;text-decoration: none; \"> <span style=\"position: absolute; display: table-cell; text-align:center; width:160px; height:25px; border-radius: 5px; background-color:" & Part($buttonone,2, "@") & ";  font-weight: bold; \" onMouseOver=\"this.style.backgroundColor='" & Part($buttonone,3, "@") & "'\" onMouseOut=\"this.style.backgroundColor='" & Part($buttonone,2, "@") & "'\"><span style=\"position:relative; top:25%;\">" & Right($buttonone, "@") & "</span></span></a>","") & 
If($buttontwo<>"","<a href=\""  & Left($buttontwo, "@") & $onclickone & Left($buttontwo, "@") & $onclicktwo & "\" style=\"color:white;text-decoration: none;\"> <span style=\"position: absolute; display: table-cell; text-align:center; width:160px; height:25px; border-radius: 5px; background-color:" & Part($buttontwo,2, "@") & ";  left: 170px; font-weight: bold; \" onMouseOver=\"this.style.backgroundColor='" & Part($buttontwo,3, "@") & "'\" onMouseOut=\"this.style.backgroundColor='" & Part($buttontwo,2, "@") & "'\"><span style=\"position:relative; top:25%;\">" & Right($buttontwo, "@") & "</span></span></a>","") & 
//If($buttonthree<>"" and [Status]<>"On Hold","<a href=\""  & Left($buttonthree, "@") & $onclickone & Left($buttonthree, "@") & $onclicktwo & "\" style=\"color:white;text-decoration: none;\"> <span style=\"position: absolute; display: table-cell; text-align:center; width:130px; height:25px; border-radius: 5px; background-color:" & Part($buttonthree,2, "@") & ";left: 280px; font-weight: bold; \" onMouseOver=\"this.style.backgroundColor='" & Part($buttonthree,3, "@") & "'\" onMouseOut=\"this.style.backgroundColor='" & Part($buttonthree,2, "@") & "'\"><span style=\"position:relative; top:25%;\">" & Right($buttonthree, "@") & "</span></span></a>","") & 
"</div>", ""
)
No RepliesBe the first to reply