Forum Discussion

ThomasEasterli1's avatar
ThomasEasterli1
Qrew Trainee
5 years ago

URL button to preform multiple actions in same click

Have an URL Button on a parent (table 1 parent) TASKS table that checks a user out of a task and loads necessary info into a child (table 2 child) TIME_CARDS table.
It's been requested that upon click of button, two basic functions are preformed:

1) Adds necessary info to the child TIME_CARDS table.
2) Loads new record form for child (table 3 child) TASKS_CHECK_OUTS table and pre-populates a few fields in said form.

There has been several unsuccessful iterations of the code.  Currently the code is as follows and works in that it adds the necessary info to the TIME_CARDS table. However, it does not load the correct TASKS_CHECK_OUTS form.

var text url=

URLRoot() & "db/" & [_DBID_TIME_CARDS] & "?a=API_EditRecord&apptoken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
& URLEncode ([Max Check-In Time Card Record ID # for Current User])
& "&_fid_33=" & URLEncode(Now()) // check out
& "&_fid_35=" & URLEncode([WORK_ORDER - wo_number])
& "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_TASKS_CHECK_OUTS] & "?a=nwr&dfid=2"
& "&_fid_9=" & URLEncode([Record ID#])
)
;

If([Max Check-In Time Card Record ID # for Current User]>=1,
"javascript:" & "$.get('" & $url & "', function(){" & "location.reload(true);" &
"});" & "void(0);"
)

Please advise.

------------------------------
T$
------------------------------

6 Replies

  • Try just this

    URLRoot() & "db/" & [_DBID_TIME_CARDS] & "?a=API_EditRecord&apptoken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    & URLEncode ([Max Check-In Time Card Record ID # for Current User])
    & "&_fid_33=" & URLEncode(Now()) // check out
    & "&_fid_35=" & URLEncode([WORK_ORDER - wo_number])

    & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_TASKS_CHECK_OUTS] & "?a=nwr&dfid=2"

    & "&_fid_9=" & URLEncode([Record ID#]))

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • ThomasEasterli1's avatar
      ThomasEasterli1
      Qrew Trainee
      Your suggestion is to add a blank line in the code to separate the table's actions?

      Well, I tried it and it was unsuccessful.

      ------------------------------
      T$
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        No,  my suggestion was to only use this code and forget the javascript stuff and var URL=

        The extra space was to just mentally separate the two steps.

        URLRoot() & "db/" & [_DBID_TIME_CARDS] & "?a=API_EditRecord&apptoken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        & URLEncode ([Max Check-In Time Card Record ID # for Current User])
        & "&_fid_33=" & URLEncode(Now()) // check out
        & "&_fid_35=" & URLEncode([WORK_ORDER - wo_number])

        & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_TASKS_CHECK_OUTS] & "?a=nwr&dfid=2"

        & "&_fid_9=" & URLEncode([Record ID#]))

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------
  • Try wrapping everything inside the var text inside a URLEncode like below. This is a method that I use when doing 2 different types of API commands in a single button click so it might work here as well.  I also changed the third line data from Now() to "today" because Now() gives the time that the browser last refreshed not the actual now. 
    var text url=


    URLEncode(URLRoot() & "db/" & [_DBID_TIME_CARDS] & "?a=API_EditRecord&apptoken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    & URLEncode ([Max Check-In Time Card Record ID # for Current User])
    & "&_fid_33=" & URLEncode("today") // check out
    & "&_fid_35=" & URLEncode([WORK_ORDER - wo_number])
    & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_TASKS_CHECK_OUTS] & "?a=nwr&dfid=2"
    & "&_fid_9=" & URLEncode([Record ID#])
    ))
    ;

    If([Max Check-In Time Card Record ID # for Current User]>=1,
    "javascript:" & "$.get('" & $url & "', function(){" & "location.reload(true);" &
    "});" & "void(0);"
    )


    ------------------------------
    jason johnson
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      I think, that Thomas already has it working from the post above, but I appreciate the "today" tip.

      ------------------------------
      Mark Shnier (YQC)
      Quick Base Solution Provider
      Your Quick Base Coach
      http://QuickBaseCoach.com
      mark.shnier@gmail.com
      ------------------------------