Discussions

Expand all | Collapse all

Ways to update a record, add a record, and return home

  • 1.  Ways to update a record, add a record, and return home

    Posted 06-11-2020 19:05
    I have been playing with an idea to allow users to "Go for lunch" in a time recording app.
    Right now, when they start their day, they click a "Login" button and it takes them to an New Login form. Once they save and close, it records the time and they return to the dashboard.
    One report on the dashboard shows their latest logins and contains a button for logging them out. When they log out, it refreshes and stays on the dashboard. They can then click new login as required.

    Issue 1
    I need to add some data checking so they cannot have more than one Login entry at a time. I am not sure how to accomplish this.

    Issue 2
    ​I want to add another URL Formula button that logs out the current record and then creates a new Login Entry that includes the log in time, log out time (for 1/2 hour later) and sets the related task link to the "Taking Lunch" task ID. I have tried a variety of methods, but I cannot get it to work.

    If you have any ideas about what tools will work best for this, I would appreciate the help.

    Note: I am using a check field set to True by URL in order to get the accurate date and time to record.

    ------------------------------
    Ray Moss
    Essence QB Admin
    Essence Cabinets Inc.
    Edmonton, AB, CAN
    ------------------------------


  • 2.  RE: Ways to update a record, add a record, and return home

    Posted 06-12-2020 07:47
    The button can be completed using a formula URL to call an edit API similar to this:

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

    "<a class=\"Vibrant Danger\" style=\"width:310px; text-align: center;\" href=\"javascript:" & "$.get('" & $url &
    "',function(){" & "location.reload();" & "});" &
    "void(0);\">Go to Lunch</a>"
    (modified version of a button from the Magic Button app)
     
    You could put the button inside an If statement so it can only be clicked if the lunch checkbox is unchecked.  Since the button click is checking a checkbox, it can only check the box once, you really don't need much validation.  But you could use dynamic form rules or custom data rules for validation if you wish.  You can use dynamic form rules or an automation to create a timestamp once the button is checked.  Additionally, I would set the access on the checkbox so only admins have edit permission.

    I hope that gives you a good starting point.

    ------------------------------
    Paul Peterson
    ------------------------------



  • 3.  RE: Ways to update a record, add a record, and return home

    Posted 06-12-2020 11:44
    I will give this a shot. Thanks.

    ------------------------------
    Ray Moss
    Essence QB Admin
    Essence Cabinets Inc.
    Edmonton, AB, CAN
    ------------------------------