IvanWeiss
3 years agoQrew Captain
Struggling with Formula API that edits records in two apps
Hello,
I am building an expense reporting platform that does the following via a button:
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("iweiss@elitestudioe.com") &
"&_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",
If($StatusCheck=true,
"<div><a style='" & $styleOptns & "' class='Vibrant' href='"
& $URLOne &
"&rdr=" & URLEncode($URLTwo) &
URLEncode("&rdr=" & URLEncode($URLThree))
& "'>Submit Expense Report</a></div>","Processing Report"))
------------------------------
Ivan Weiss
------------------------------
I am building an expense reporting platform that does the following via a button:
- Employee hits Submit Expense Report Button
- It updates the status to the next status category (this works)
- 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)
- 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("iweiss@elitestudioe.com") &
"&_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",
If($StatusCheck=true,
"<div><a style='" & $styleOptns & "' class='Vibrant' href='"
& $URLOne &
"&rdr=" & URLEncode($URLTwo) &
URLEncode("&rdr=" & URLEncode($URLThree))
& "'>Submit Expense Report</a></div>","Processing Report"))
------------------------------
Ivan Weiss
------------------------------