Formulas and Form Rule Use Cases Kirk Trachy QuickBase Sales Engineer.

Post on 21-Jan-2016

236 views 1 download

Transcript of Formulas and Form Rule Use Cases Kirk Trachy QuickBase Sales Engineer.

Formulas and Form Rule Use Cases

Kirk Trachy

QuickBase Sales Engineer

How to use Formulas and Form Rules to solve common workflow challenges

• Explore 60 Formula URL and Formula Text field use cases• Some will work with form • How to use graphics to edit a project• How to use common features for assignment, email and approval• Look at two ways to create project templates• Consider a simple way to handle tasks and sub-tasks• Test the formulas• See how they work• Discuss options and possibilities

Agenda

• Automate complex processes• Provide a custom user experiences• Ease new user adoption• Save training time• Simplify use

Benefits of Formulas and Form Rules

Get “Magic Buttons” App from App Exchange

Green Square Bar Graph

var text star = "<img" & " src=\"" & "https://images.quickbase.com/si/16/228-rect_green.png\">";var text notstar = "<img" & " src=\"" & "https://images.quickbase.com/si/16/226-rect_gray.png\">";var number numberstars = (Floor([% Project Completed] * 10));

//10 is the number of units, because 10 is 1/10th of 100.

"<span alt=\"" & ToText($numberstars) & " of 10 \" title=\"" & ToText($numberstars) & " of 10 \" class=\"NoWrap\">" & If($numberstars >= 1, $star, $notstar) & If($numberstars >= 2, $star, $notstar) & If($numberstars >= 3, $star, $notstar) & If($numberstars >= 4, $star, $notstar) & If($numberstars >= 5, $star, $notstar) & If($numberstars >= 6, $star, $notstar) & If($numberstars >= 7, $star, $notstar) & If($numberstars >= 8, $star, $notstar) & If($numberstars >= 9, $star, $notstar) & If($numberstars >= 10, $star, $notstar) & "</span>”

// Uses a formula text field to display the colored graphics

Green Square Bar Graph (Press to adjust %)

This option allows you to press one of the 10 boxes and it invokes an API_EditRecord to change the value of the % Project Complete field. This changes the number of green boxes versus gray boxes.

After executing it returns back to from where it started.

Open the application and edit the field properties to view the code.

There is too much code to display in this slide.

Assignment, email workflow, approval and log

• Using radio button to trigger email notification• Using radio button to activate pointer graphic• Using logging text to capture approvals• Using a formula checkbox to track approvals• Using logging text to capture audit trail

Status Background Color

Case ([Color Status],"Not Started", "<div style=\"background-color:pink;width:50\">Not Started</div>",

"In-Progress","<div style=\"background-color:lightyellow;width:50\">In-Progress</div>",

"Completed","<div style=\"background-color:honeydew;width:50\">Completed</div>",null)

Status Text Color

Case([Color Status], "Not Started", "<font color=red>Not Started</font>", "In-Progress", "<font color=orange>In-Progress</font>", "Completed", "<font color=green>Completed</font>")

Project Template Selector

"javascript:void(copyMasterDetailButtonHandler('&sourceRID="&[Template Selector]&"&destrid=" & [Record ID#] & "', 'bjq8b7xcx'))”

// Note the [Template Selector] field advising this button to import tasks from a specific template

Tasks and Sub-Tasks Option

URLRoot() & "db/" & [_DBID_TASKS] & "?act=API_GenAddRecordForm&_fid_48=" & [Related Project] & "&_fid_6=" & [Task Name] & "&z=" & Rurl()

// This formula URL is added to the task table

// and is invoked from the embedded report link of all the tasks on the project record

1A. Change status to completed then display record

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_28=Completed" &

"&_fid_143=100" &

"&_fid_153=Completed" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#])

// Press the button and this changes the status of this record to "Completed" and

// then redirects back to the same form in display record mode

2A. Change status to completed then dashboard

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_28=Completed" &

"&_fid_153=Completed" &

"&_fid_143=100" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid())

// Press the button and this changes the status of this record to "Completed" and

// then redirects to the dashboard

3A. Check a checkbox then display record

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] & "&apptoken=d9eascudwjxs2sesxkjccwgtq9r" & "&_fid_101=1" & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])

// Press the button and this changes the "Checkbox" to checked and// then redirects back to the same form in display record mode

4A. Check/Uncheck a checkbox then display record

If([Checkbox] = false, URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_101=1" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#]),

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_101=0" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#]))

5A. Check/Uncheck a checkbox then edit record

If([Checkbox] = false,

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_101=1" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=er&rid=" & [Record ID#]),

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_101=0" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=er&rid=" & [Record ID#]))

6A. Show/Hide project section then display record

If([Show Project Section] = false, URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_105=1" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#]),

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&rid=" & [Record ID#] &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_105=0" &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#]))

7A. Change to a different form then display record

URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#] &

"&dfid=13"

// When pressed this will display the record you are already on but with an alternate form (dfid=13)

8A. Assign to self then display record

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

"&AppToken=d9eascudwjxs2sesxkjccwgtq9r" &

"&rid=" & [Record ID#] &

"&_fid_97=" & URLEncode(User()) &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#])

// Press a button and assign yourself as "Project Manager" and then redirect to display the form

9A. Create a project snapshot then display record

URLRoot() & "db/" & [_DBID_PROJECT_SNAPSHOTS] & "?a=API_AddRecord" &

"&apptoken=d9eascudwjxs2sesxkjccwgtq9r" &

"&_fid_6=" & [Project Name] &

"&_fid_7=" & [Status] &

"&_fid_8=" & [Priority] &

"&_fid_9=" & [Est Start Date] &

"&_fid_10=" & [Est End Date] &

"&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() &

"?a=dr&rid=" & [Record ID#])

// Press the button and uses API_AddRecord to pass Project Name, Status, Priority, etc.

// to a snapshot table named [_DBID_PROJECT_SNAPSHOTS]

10A. Pop up an alert

"javascript:alert('This is your alert! Now you can create your own alerts.')"]

11A. Check or uncheck and return

var text url =

If([Checkbox] = false,

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=1",

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=0");

"javascript:" &

"$.get('" &

$url &

"',function(){" &

"location.reload();" &

"});" &

"void(0);"

12A. Check and uncheck a checkbox and display

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=" & 1 & "&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=" & 0 & "&rdr=" &

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

// Using the API_EditRecord this checks the checkbox at fid_101 and then redirects (rdr)

// and unchecks the checkbox and

// then redirects back to a displayed record (dr)

13A. Confirm then check and uncheck and display

"javascript:if(confirm ('Are you sure you want to email this record?')){location.assign('/db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=" & 1 & "&rdr=" &

URLEncode(URLEncode(URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=" & 0 & "&rdr=" &

URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#] & ""))) & "')}"

// This button confirms you wish to email a record.

// This assumes you have an email notification ready to fire when the check box field 101 is checked.

// After checking the checkbox this redirects to uncheck the checkbox and then redirects to display the record.

// It looks like nothing has happened but it has.

14A. Check and uncheck and return

var text url =

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=" & 1 & "&rdr=" &

URLEncode(URLEncode(URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID#] & "&_fid_101=0"));

"javascript:" &

"$.get('" &

$url &

"',function(){" &

"location.reload();" &

"});" &

"void(0);”

15A. Change the status to completed and return

var text url =

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] & "&apptoken=d9eascudwjxs2sesxkjccwgtq9r" & "&_fid_28=Completed" & "&_fid_153=Completed" & "&_fid_143=100";

"javascript:" & "$.get('" & $url & "', function(){" & "location.reload();" & "});" & "void(0);"

// Sets a variable called url with a url constructed of an API_EditRecord and changes fid_28 to Completed// The bottom of this formula then calls the URL and reloads the page from where you came.// If you originated in edit your will end in edit.// If you originated in display you will end in display.// If you originated on a report you will end on a report.// If you originated on a dashboard you will end on a dashboard.

16A. Go to some URL

"http://quickbase.intuit.com/webinars/recordings"

17A. Print

URLRoot() & "db/" & Dbid() & "?a=printr&rid=" & [Record ID#]

// DISCLAIMER: This is not a supported QuickBase feature. QuickBase reserves the right to change this code at any time without notice.

18B. My button label changes

"<a class=\"Vibrant Success\" href=\"http://quickbase.intuit.com/webinars/recordings\">" & [18A. Label text] & "</a>"

// This button takes you to a list of recorded Webinars at http://quickbase.intuit.com/webinars/recordings/.

// Change the URL to change the destination URL.

// Changing the Status field drop down box will change the text on the button.

// Option: You can remove the " & [18A. Label text] & " and insert your own fixed text.

19A. Submit and redirect

URLRoot() & "db/" & Dbid() & "?a=dbpage&pagename=success.html"

// This works because you have turned on the table's advance settings, "Save parent record automatically when a child record is created."

// When you press this button it automatically saves the record before going to your destination page.

20A. Edit record then add record then display record

URLRoot() & "db/" & [_DBID_CLIENT] & "?a=API_EditRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_28=Completed&_fid_153=Completed&_fid_143=100&rid=" & [Record ID#] & "&rdr=" &

URLEncode(URLRoot() & "db/" & [_DBID_PROJECT_SNAPSHOTS] & "?a=API_AddRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_6=" & [Project Name] & "&_fid_7=" & [Status] & "&_fid_8=" & [Priority] & "&_fid_9=" & [Est Start Date] & "&_fid_10=" & [Est End Date] & "&rdr=" &

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

// Edit the record and change the status to Completed then redirect to

// Adding a Project Snapshot record to the Project Snapshot table then redirect to

// displaying the original record

Other buttons

QUESTIONS?