Forum Discussion

IvanWeiss's avatar
Qrew Captain
2 years ago

Struggling with Formula API that edits records in two apps


I am building an expense reporting platform that does the following via a button:
  1. Employee hits Submit Expense Report Button
  2. It updates the status to the next status category (this works)
  3. It creates a task in my main ERP app for the next inline to review the expense report (this does not work, it displays the dashboard of this other app)
  4. It should navigate back to the current record in the original app (does not work)

I can get through #2, and on #3 above it just displays the dashboard of the other app, no new task is created and I dont navigate back to the current app.  here is my code thus far:

i appreciate in advance the help!

//Button Styling:
var text decoration = "text-decoration: none;";
var text bgColor = "background: #009bce;";
var text txtColor = "color: white;";
var text txtAlign = "text-align: center;";
var text txtShadow = "text-shadow: none;";
var text border = "border-radius: 5px;";
var text padding = "padding: 8px 20px;";
var text display = "display: inline-block;";
var text font = "font: normal 700 24px/1 'Calibri', sans-serif;";
var text styleOptns = List("", $decoration, $bgColor, $txtColor, $txtAlign, $txtShadow, $border, $padding, $display, $font);

//UrlOne: Change Status of current expense report to In Executive Review
var text URLOne = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
[AppToken] &
"&_fid_6=In Executive Review";

//URLTwo: Assign a task to Executive Approval in Team Elite App
var text URLTwo = URLRoot() & "db/bpmv2s5ny" & "?a=API_AddRecord=" &
"&apptoken=hiddenforsecurity" &
"&_fid_6=Review Expense Report" &
"&_fid_8=" & URLEncode(Today()) &
"&_fid_9=" & URLEncode(WeekdayAdd(Today(),1)) &
"&_fid_24=Assigned" &
"&_fid_28=Not Applicable" &
"&_fid_52=" & URLEncode("") &
"&_fid_69=" & URLEncode([Related Team Member]);

//Display the expense report record
var text URLThree = URLRoot() & "db/bspk82e7" & "?a=dr&rid=" & [Record ID#];

//Display the button only if all required receipts are uploaded. Otherwise display error text.
var bool ReceiptsCheck = If([# of Expense Records over 75 without Receipts]=0,true,false);
var bool StatusCheck = If([Status]="Not Submitted",true,false);

If($ReceiptsCheck=false,"Please upload missing receipts",
"<div><a style='" & $styleOptns & "' class='Vibrant' href='"
& $URLOne &
"&rdr=" & URLEncode($URLTwo) &
URLEncode("&rdr=" & URLEncode($URLThree))
& "'>Submit Expense Report</a></div>","Processing Report"))​​

Ivan Weiss

9 Replies

  • Are you sure that submit method work with several  Concat url?  

    Marcelo Benavides Torres 

    • IvanWeiss's avatar
      Qrew Captain
      That is why I posted :)  Cause it is not working so something is wrong in there....

      Ivan Weiss
      • MarceloBenavide's avatar
        Qrew Cadet
        Hi. Ok , I'm sorry, I think that you need check the several url in the submit call. 

        Marcelo Benavides Torres