Forum Discussion

LizChartrand's avatar
LizChartrand
Qrew Cadet
5 years ago

Rich Text Button Help - Completing more than one task

Hello,


I'm trying to create a button that, will check different boxes when clicked in a sequence so we can monitor task completion on a record.
For instance, when clicked once the button checks a checkbox, stamps a field with the user who clicked the button, then refreshes the page. When clicked a 2nd time the button checks a different check box, stamps a field with the user who clicked the button, then refreshes the page. 

I haven't tried to build a multitasking button or creating one without javascript to refresh the page, yet. 
I came across a few suggestions that I thought I could patchwork together (added below) - are there any suggestions about how to make this button work to sequentially checkboxes?

Thank you!

//step 1 initial QB update check box checked
var text URL= "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() &"?a=dr&rid="&[Record ID#]);
var text URLONE = URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_82=" & URLEncode(UserToName(User()))
& "&_fid_77=true"
& "&apptoken=...";

//step 2 CRT complete check box checked
var text URLTWO=
URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_=82" & URLEncode(UserToName(User()))
& "&_fid_80=true"
& "&apptoken=...";

If(
[QB Update Complete?]=true,
"<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'>Lease Execution Complete?</a>",
[CRT completed?]=true,
"<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'>Completed</a>","<a class='Vibrant Success' style='border:1px solid #6BBD57; background-color:#6BBD57'>Units Updated?</a>")

------------------------------
Liz Chartrand
------------------------------
  • I'm not certain I got your logic 100% accurate, but I think I would go for something like this instead:

    
    //Token
    var text tk = "xxxxxxxxxxxx";
    
    //Checkbox FID
    var text ck = If(
    [QB Update Complete?],"&_FID_77=1",      //Update FID 77
    [CRT completed?],"&_FID_80=1");          //Update FID 80
    
    //Button Name
    var text name = If(
    [QB Update Complete?],"Lease Execution Complete?",
    [CRT completed?],"Completed","Units Updated?");
    
    //Landing Page
    var text URL = URLRoot() & "db/" & Dbid() &"?a=dr&rid="&[Record ID#]);
    
    //Base Action URL
    var text base = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=" & $tk &
    "&rid=" & [Record ID#] &
    "&_fid_82=" & URLEncode(UserToName(User()));
    
    //Primary URL
    var text URL = $base & $ck & "&RDR=" & URLEncode($land);
    
    "<a class='Vibrant Success' href='" & $url & "'>" & $name & "</a>"​


    ------------------------------
    Blake Harrison
    bharrison@datablender.io
    DataBlender - Quickbase Solution Provider
    Atlanta GA
    404.800.1702 / http://datablender.io/
    ------------------------------
  • I'd suggest using an if-statement to determine which checkbox to check each time the button is pressed. If none of the boxes are checked, follow URL1, if the first box is checked, URL2, etc.

    if([checkbox 1] = false, URL1, [checkbox 1] = true and [checkbox 2] = false, URL2...

    ------------------------------
    A Brown
    ------------------------------
    • LizChartrand's avatar
      LizChartrand
      Qrew Cadet
      Absolutely,

      I was missing a few pieces in fact -

      The following ended up working:

      //step 1 initial QB update check box checked

      var text URLONE =
      URLRoot() & "db/" & Dbid() & "?act=API_EditRecord" &
      "&rid=" & [Record ID#] &
      "&apptoken=[]" &
      "&_fid_82=" & URLEncode(UserToName(User())) &
      "&_fid_77=true" &
      "&rdr=" &
      URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);



      //step 2 CRT complete check box checked
      var text URLTWO=
      URLRoot() & "db/" & Dbid() & "?act=API_EditRecord" &
      "&rid=" & [Record ID#] &
      "&apptoken=[]" &
      "&_fid_82=" & URLEncode(UserToName(User())) &
      "&_fid_80=true" &
      "&rdr=" &
      URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);

      var text FIRSTURL =
      $URLONE;

      var text SECONDURL =
      $URLTWO;


      If(
      [QB Update Complete?]=false and
      [CRT completed?]=false,
      "<a class='Vibrant Primary' style='border:1px solid #ffffff; background-color:#6BBD57'" & "a href=" & $FIRSTURL & ">Units Updated</a>",
      If([QB Update Complete?]=true and
      [CRT completed?]=false,
      "<a class='Vibrant Primary' style='border:1px solid #ffffff; background-color:#6BBD57'" & "a href=" & $SECONDURL & ">Lease Execution Completed</a>",
      If([QB Update Complete?]=true and
      [CRT completed?]=true,
      "<a class='Vibrant Alert' style='border:1px solid #ffffff; background-color:#6BBD57'>Completed</a>"
      )))


      Thank you for your help!

      ------------------------------
      Liz Chartrand
      ------------------------------