Bulk add activities

  • 1
  • 1
  • Question
  • Updated 1 year ago
  • Answered
How can I add an activity (the same activity) to a sorted/filtered list of contacts? i.e. sending the same information to all of them
Photo of Danielle Roffe

Danielle Roffe

  • 92 Points 75 badge 2x thumb

Posted 1 year ago

  • 1
  • 1
Photo of Chuck Grigsby

Chuck Grigsby

  • 1,978 Points 1k badge 2x thumb
I would do this with some javascript. Using a multi-select user field it will take all thats selected and create that many records with any assigned values as well. Have a demo of this if you'd like to setup a call. Chuck@Chuck.Support

Welcome to edit my code and use it. Basically in my case the multi select is a document type. and when they click save it creates children doc records, one for each value selected. 

                $(docType).each(function(i, val) {
                    csv += kRid + ", " + val + ", " + new Date() + " \n "
                })

                var dataDocs = {
                    act: "API_ImportFromCSV",
                    records_csv: csv,
                    clist: "12.7.15"
                }

                var addDocTypes = $.post(dbidDocs, dataDocs)
                addDocTypes.done(function(xml) {
                    console.dirxml(xml);
                    var rids = $("rids rid", xml).map(function() {
                        return $(this).text()
                    })
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,346 Points 50k badge 2x thumb
Do you mean to add a child activity to each contact?
Mark
Photo of Danielle Roffe

Danielle Roffe

  • 92 Points 75 badge 2x thumb
I think so, yes.  I'm a new user, so still getting accustomed to the terminology...
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,346 Points 50k badge 2x thumb
Do you have a relationship where 1 Contact has many Activities?
Photo of Danielle Roffe

Danielle Roffe

  • 92 Points 75 badge 2x thumb
absolutely
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,346 Points 50k badge 2x thumb
OK, so here is a native solution.  We will get it working semi automated and then we will make a button.

Make a check box field on contacts indicating that they need the activity added. 

Make fields on the on the Contact record as formula fields populated with what you want to fill into the Activity.  For example

Std Activity Description as a text formula field

"Call Contact" 

Then go to the Activity Table Home Page and More .. and Import export and then import from another table.

Select the Activities table.

Choose the table to import from as the Contacts.

Set a filer to only copy record which have that checkbox checked.
Map the Record ID into the field [Related Contact]
Map the Std Activity Description into the field Activity Description.

Then save the table to table copy, and check some checkboxes in Contacts and then manually run that import and see if Child records are created.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,522 Points 20k badge 2x thumb
OP>How can I add an activity (the same activity) to a sorted/filtered list of contacts?

I think the OP is asking how to add child records to the currently selected set of filtered records being displayed. This is how I would proceed:

You need to use the IOL technique (or other injection technique) and introduce a button into the head of the form as shown here:

Process Selected Records
https://haversineconsulting.quickbase.com/db/bkfwuwx2p?a=td

All we need to do is get the button introduced - we will not be using the checkboxes shown as the selection mechanism in the above demo. Rather we will use the native dynamic filters to select a reduced set of records that you want to add the activity to.

Now after a user filters the displayed records and the button is clicked run a script like this and grab the rid attribute QuickBase places on each row of the table row results:
var rids= $("table.searchResults tr:[canview=true]").map(function() {
  return $(this).attr("id").substr(3);
}).get();
console.log(rids);

Now we know the complete set of [Record ID#]s for which the user wants to add some child record and we can call API_AddRecord or API_ImportFromCSV to populate the child records.

I should mention that you can paste this script into the console of some filtered report and an array of rids will be logged to the console reflecting the filtered set of records.
(Edited)