Forum Discussion
JamesDalton
5 years agoQrew Trainee
So this is what I came up with
------------------------------
James Dalton
------------------------------
var text nextStatus = If([Status] = "Pending Initial Action", "Assigned To Underwriter", [Status] = "Assigned To Underwriter", "Quote Sent", [Status] = "Quote Sent", "Awaiting Payment", [Status] = "Awaiting Payment", "Payment Received/Make Live", [Status] = "Payment Received/Make Live", "Policy Live/Money Received", [Status] = "Policy Live/Money Received", "All Appropriate Documents Received", [Status] = "All Appropriate Documents Received", "Policy Documents Sent to Broker");
var text changeStatus= URLRoot() & "db/" & [_DBID_RENEWALS] & "?a=API_EditRecord&rid="&[Record ID#]&"&apptoken=d24xdccdwjqg6s9cdce8bq29d8n"&"_fid_10=$nextstatus";
"javascript:" &
"$.get('" &
$changestatus &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"
Where _fid_10 is the status field. Did I get something wrong with the syntax? Appreciate any insight.------------------------------
James Dalton
------------------------------
BlakeHarrison
5 years agoQrew Captain
I'd suggest the following instead:
I think I mentioned it in another question you'd posted, but this would be intended to be used in View mode, typically I'd suggest setting it up as a "Submit" or "Complete" button. On the form, you'll want to also make the Status field 'Read Only' unless the user is in an Administrator role.
------------------------------
Blake Harrison
bharrison@datablender.io
DataBlender - Quickbase Solution Provider
Atlanta GA
404.800.1702 / http://datablender.io/
------------------------------
var text nextStatus = Case([Status],
"Pending Initial Action","Assigned To Underwriter",
"Assigned To Underwriter", "Quote Sent",
"Quote Sent", "Awaiting Payment",
"Awaiting Payment", "Payment Received/Make Live",
"Payment Received/Make Live", "Policy Live/Money Received",
"Policy Live/Money Received", "All Appropriate Documents Received",
"All Appropriate Documents Received", "Policy Documents Sent to Broker");
var text changestatus= URLRoot() & "db/" & dbid() & "?a=API_EditRecord&rid="& URLEncode(Record ID#])&"&apptoken=d24xdccdwjqg6s9cdce8bq29d8n" &
"_fid_10=" & URLEncode($nextstatus);
var text land = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & URLEncode([Record ID#]);
"<a class='Vibrant Success' & href=" &
$url &
URLEncode($land)
& ">Submit</a>"
I think I mentioned it in another question you'd posted, but this would be intended to be used in View mode, typically I'd suggest setting it up as a "Submit" or "Complete" button. On the form, you'll want to also make the Status field 'Read Only' unless the user is in an Administrator role.
------------------------------
Blake Harrison
bharrison@datablender.io
DataBlender - Quickbase Solution Provider
Atlanta GA
404.800.1702 / http://datablender.io/
------------------------------
- JamesDalton5 years agoQrew TraineeThanks Blake,
I came up with a different solution that allows for the same functionality while still having the dynamic form rule prompts working. Basically what I did, was that I gave each status a designated number 1 - 9, which gets saved in the status log table along with the status. Then, I use a summary field which then "pulls up" the most recent status along with the designated order number of that status. When a user is picking a status in the dropdown, if the order number of that status is less than the most recent pulled up number from status log, no dice, the form rule kicks in and says "can't choose previous status" and changes the status back to the most recent one from status log. It seems to be working so far.
I definitely can see the potential in the button and I will keep that concept in mind when adding/changing features to my app. Thanks for all your help.
------------------------------
James Dalton
------------------------------