Automatic Creation of a Reoccuring Task

  • 0
  • 1
  • Question
  • Updated 5 years ago
  • Answered

We have task that we complete on a monthly/weekly basis. Is there a way to have QuickBase automatically create a new task for the next month/week once the current one is marked complete?

Photo of JEREMY

JEREMY

  • 0 Points

Posted 5 years ago

  • 0
  • 1
You could make a formula URL button which would mark the task complete, and then create a new Task Record for the next week.  To help you with that I would need to know which fields need to be populated when the task record is created and also after you push the button where do you want to land  - ie do you want to just refresh the task record you are sitting on?
Photo of Wendy

Wendy

  • 0 Points
I've been using QuickBase for several years and I have not found a way for this to be possible...yet. I am hoping someone else might contribute something that would make my life easier.

I manually take the item, copy, make the necessary changes and save. If you find out something different. Please share. :-)


~Wendy
Photo of JEREMY

JEREMY

  • 0 Points
Thanks for the assistance. We would need the URL to create a new record in the same table based on the current record's fields. The fields that would need to be copied are [Project Name], [Task Name], [Assigned To], [Priority] and [Description]. The new dates for the [Start] and [Projected Finish] would be calculated based on the repeat fields. Ideally we would have an option to repeat every month on the same date, or every week on the same day.
Here is an example of a URL formula which will mark the record complete and create a new record.  It leaves the [Start] and [Projected Finish] empty as I'm not understanding what they should be when the button is pushed.  This particular formula will land the user on the newly created record.

var text URLONE = URLRoot() & "db/" & Dbid() & "?act=api_editrecord&rid=" & [Record ID#]& "&_fid_14=1";
// that line above will edit the current record and set the field with field ID of 14 to be true (checked).  
// That would be your [Completed] checkbox field.

var text URLTWO =URLRoot() & "db/" & Dbid() & "?act=api_addrecord"
& "&_fid_10=" & URLEncode([Project Name])
& "&_fid_11=" & URLEncode([Task Name])
& "&_fid_12=" & URLEncode([Assigned To])
& "&_fid_13=" & URLEncode([Description])
& "&disprec=1";

$URLONE & "&rdr=" &URLEncode($URLTWO)
Photo of JEREMY

JEREMY

  • 0 Points
Thanks Mark. This helps

The [Start] and [Projected Finish] fields should equal the value of the current task + 7 days or + 1 month. We would add a field name [Reoccurance] with three options; "No Reoccurance", "Monthly", "Weekly". Depending on the value in this box would determine the new dates for these two fields.

This would then populate all information needed and the new task wouldn't need to be opened, the user could be redirected to the home page.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
This is easy to do technically but to be honest you need to put some more thought into how you want to invoke this capability. In other words, the defined workflow is more important than writing the script. By workflow I mean (1) what type of page you are currently on, (2) how you want to invoke the functionality, and (3) what you want to do when the procedure is completed. However, based on what you described I put together this simple application in a few minutes:

Duplicate Record

https://haversineconsulting.quickbase.com/db/biwtzvt9m


Instructions: Edit a record, check the Complete? checkbox (once or twice as needed) and a new record will be created and a dialog box displayed indicating so. The new record will draw its values from the current values in the form (which might be different than the values in the database if the form is not saved).

Pastie Database

https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=259


The basic functionality could be packaged in a dozen different ways.

Note: The code used the date.js library which allows you to manipulate and format dates in a wide variety of ways. I used the library to format the current Start date for the current day and set the Projected Finish to be 14 days in the future. Any other calculation you desire can be implemented.

Date.js Library

http://www.datejs.com/

ProTip: The most important piece of information to provide when asking a question is the context in which you want to invoke some new functionality. The script to implement it is normally trivial to write.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
Seven reasons not to use a Formula URLs:

1) Formula URLs can only synthesize GET requests. In many cases you need to use a POST request or perform more than one GET/POST requests to complete the task.

2) Formula URLs often need to have parameters URL encoded. Doing this manually often results in errors. You don't have to URL encode parameters passed via AJAX calls as jQuery will do that for you if necessary.

3) Formula URLs can never return the status of the operation or handle any error. The only control you have over a formula URL is if or where you redirect to after the base URL is loaded.

4) Formula URLs when used with a redirect are slow as the return an extra server response that tells the browser to load the redirect URL.

5) If you need to invoke multiple API methods in sequence you will have a difficult time forming the rdr parameter because of the escaping that is needed to prevent the URL sepecified in the rdr field from being parsed as part of the base API endpoint.

6) If you use formula URLs you will not be able to benefit from libraries such as date.js (for formatting dates) or accounting js (for formatting money). Instead you will have to clog your application with additional formula fields that only serve the temporary purpose of helping to build the formula URL.

7) Even if you get your formula URL working the slightest change in the problem statement can break you formula or prevent a solution. If you use script instead you will always be guaranteed a solution even if the problem statements changes over time. One technology to use all the time.
I think that this version works.

var date NewStart=
Case([Reoccurance],
"Weekly",[Start]+Days(7),
"Monthly",AdjustMonth([Start],1));

var date NewFinish=
Case([Reoccurance],
"Weekly",[Projected Finish]+Days(7),
"Monthly",AdjustMonth([Projected Finish],1));


var text URLONE = URLRoot() & "db/" & Dbid() & "?act=api_editrecord&rid=" & [Record ID#]& "&_fid_14=1";
// that line above will edit the current record and set the field with field ID of 14 to be true (checked).  
// That would be your [Completed] checkbox field.



var text URLTWO =URLRoot() & "db/" & Dbid() & "?act=api_addrecord"
& "&_fid_10=" & URLEncode([Project Name])
& "&_fid_11=" & URLEncode([Task Name])
& "&_fid_12=" & URLEncode([Assigned To])
& "&_fid_13=" & URLEncode([Description])
& "&_fid_16=" & ToText($NewStart)
& "&_fid_17=" & ToText($NewFinish)
& "&_fid_18=" & URLEncode([Reoccurance]);

var text URLTHREE = URLRoot() & "db/" & Dbid();

$URLONE
& "&rdr=" &URLEncode($URLTWO)
& URLEncode("&rdr="& URLEncode($URLTHREE))