Discussions

Expand all | Collapse all

URL button to preform multiple actions in same click

  • 1.  URL button to preform multiple actions in same click

    Posted 26 days ago
    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$
    ------------------------------


  • 2.  RE: URL button to preform multiple actions in same click

    Posted 26 days ago
    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
    ------------------------------



  • 3.  RE: URL button to preform multiple actions in same click

    Posted 26 days ago
    Edited by Thomas Easterling 26 days ago
    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$
    ------------------------------



  • 4.  RE: URL button to preform multiple actions in same click

    Posted 26 days ago
    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
    ------------------------------



  • 5.  RE: URL button to preform multiple actions in same click

    Posted 25 days ago
    Thank you for the clarification. 

    Yes that worked as the js was overriding the previous call.

    ------------------------------
    Thomas Easterling
    ------------------------------



  • 6.  RE: URL button to preform multiple actions in same click

    Posted 25 days ago
    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
    ------------------------------



  • 7.  RE: URL button to preform multiple actions in same click

    Posted 25 days ago
    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
    ------------------------------