Forum Discussion

NirajShah's avatar
NirajShah
Qrew Cadet
7 years ago

Rich Text Formula Field for Approve / Reject button and redirection

I'm trying to setup a rich text formula field that will allow the user to "approve" or "reject" a case. When the user chooses "approve", I'd like the button to add values to three fields on the current record, do a redirect to another record on a different table and update a value of a field on that table with a value from the original record, and then do another redirect back to the original record which has been updated with the initial edits. 
For "reject", only the values are added to three fields, and no redirect is needed.

Here is what I have so far:

var text approve =  URLRoot() & "db/" & [_DBID_] & "?a=API_EditRecord&apptoken=XXXXXX&rid=" & URLEncode ([Record ID#])

& "&_fid_xx=" & URLEncode("Approved")

& "&_fid_xx=" & URLEncode(Now())

& "&_fid_xx=" & URLEncode(User())

& "&rdr=" & URLEncode(URLRoot() & "db/xxxxx?a= API_EditRecord&apptoken=xxxxxxrid=" & URLEncode ([Related Store Item])

& "&_fid_xx=" & URLEncode([# of Features Requested])

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

var text reject =   URLRoot() & "db/" & [_DBID_] & "?a=API_EditRecord&apptoken=XXXXXX&rid=" & URLEncode ([Record ID#])

& "&_fid_xx=" & URLEncode("Rejected")

& "&_fid_xx=" & URLEncode(Now())

& "&_fid_xx=" & URLEncode(User())

& "&z=" & Rurl();

Not sure where this is going wrong with the formatting or syntax errors.