Forum Discussion

BenjaminBrooks's avatar
BenjaminBrooks
Qrew Trainee
2 years ago

Save and Redirect on One Button

Hello,

We currently have two tables on that we have a relationship built. Tasks and Customers.

On the task, we have validation built so that if the status of the task is different from the status of the client, it allows for the user to update the customer from the task form with a dropdown of options [Status Change].

I am currently attempting to create a text button that does the following:
  1. Validation is met, so [Status Change] = null
    1. Saves the task record and redirects to the customer record
  2. Validation is not met, so [Status Change] is not null
    1. Saves the current task that they are on with the information that is filled out
    2. Updates the customer record with the item from [Status Change]
    3. Redirects them back to the customer's form
This is the formula that we have written:

If([Status Change]=null,
"<a class='Vibrant Primary' style=\"width:310px; text-align: center;\" href='" & URLRoot() & "db/" &[_DBID_xxxxxxxxxxx] & "?dfid=14&a=er" & "&key=" & [Phone Number]
& "'>Save Task</a>",

[Status Change]<>null,
"<a class='Vibrant Danger' style=\"width:310px; text-align: center;\" href='" & URLRoot() & "db/" &[_DBID_xxxxxxxxxxx] & "?a=API_EditRecord&key=" & [Phone Number] & "&apptoken=xxxxxxxxxxxxxxxxxx&_fid_32="&[Status Change]&"&rdr=" & URLEncode(URLRoot() & "db/" &[_DBID_CUSTOMERS] & "?dfid=14&a=er" & "&key=" & [Phone Number]) & "'>Update Status and Save Task</a>")

This formula is not saving the task.

------------------------------
Benjamin Brooks
------------------------------

1 Reply

  • If you add the SaveBeforeNavigating class to your button you should get the behavior you're looking for.  So your class attribute would be class='Vibrant Primary SaveBeforeNavigating'.

    Alternatively, there's an option in the advanced settings for the table to automatically save when the user is redirected.

    ------------------------------
    Tyler Jablonski
    ------------------------------