Forum Discussion
BlakeHarrison
5 years agoQrew Captain
If there's a strict order in which these records go from one Status to another, you could always setup the change in Status to be initiated by a button instead. So, say it's in "Quote Sent" status, your button could say something like "Submit to [Next Status]".
------------------------------
Blake Harrison
bharrison@datablender.io
DataBlender - Quickbase Solution Provider
Atlanta GA
404.800.1702 / http://datablender.io/
------------------------------
------------------------------
Blake Harrison
bharrison@datablender.io
DataBlender - Quickbase Solution Provider
Atlanta GA
404.800.1702 / http://datablender.io/
------------------------------
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
------------------------------
- BlakeHarrison5 years agoQrew CaptainI'd suggest the following instead:
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
------------------------------
- DonLarson5 years agoQrew EliteJim,
I agree with Blake to use the operational order of the Status. I suggest using your existing tables to make it happen. Add Next Status as field in the Status table.
Now do the Reverse Look Up on the relationship between Status Log and Renewal
Now your Renewal record will always know what the Record ID# of the Next Status in the series.
Now your formula is an API_AddRecord
var text URLNextStatus =
URLRoot() & "db/" & [_Status_Log] & "?act=API_AddRecord&apptoken="&$Token &"&_fid_XX=" & [Record ID#] &"&_fid_XY=" & [Max RID Status Log Next Status];
var text JAVAURL = "<a href=\"javascript:" & "$.get('" & $URLNextStatus & "', function(){" & "location.reload();" & "});" & "void(0);\">"&$MSGNext &"</a>";
If ( [Max RID Status Log Next Status]=100, "Renewal Complete", $JAVAURL)
The XX is your Related Renewal and XY is Related Status in the Status Log table.
$MSGNext is just another variable text message to show the User.
The nice thing about this approach is you only have to keep your Status Table up to date. The Formula Rich Text should not need to change as you grow, expand or reorder the Status Table.
------------------------------
Don Larson
Paasporter
Westlake OH
------------------------------- JamesDalton5 years agoQrew TraineeHi Don,
Sorry for the late reply. I did not think of a separate status table before, but it probably makes sense because it conserves more space, I'm guessing. I was using a Text-Multiple choice field in all of the records. Then I had dynamic form rules kick in with messages and warnings during certain status selections based off of the most recent status. Thanks for your help, I'll test this concept out and try to apply it in one of my demos.
------------------------------
James Dalton
------------------------------