List contacts and numbers and select one

Learn how to get multiple contacts with all their numbers, list them

  1. joaomgcd
    After this tutorial you'll be able to do this:


    • Get a contact list by name with their names, phone numbers and phone number types
    • List the contacts with all the info displaying in a list
    • Select one of the numbers and have it available in the task as a variable

    STEP 1 - GET CONTACTS BY NAME


    • In a task add an AutoContacts Query 2.0 action
    /!\ If you don't have this action it's because it's only available in the beta. If you already have it then you have the beta or the feature is already out for everyone :D
    • In the Filters section set the Names field to whatever name you want
    • In the Fields to Get field set it to get the Name and Phone Number fields
    • Accept and go back to Tasker


    STEP 2 - MERGING NAMES AND NUMBERS


    • Add a Flash action and set the text to
      %acname()
      %acnumber()
      %acnumber_type()
    • Add an AutoTools Arrays action
    • Set the Input to %acname()|%acnumber()
    • Set the Merged Array Name to contacts
    • In the Merging section enable Merge Arrays and set Merged Array Joiner to -
    (i) This will make AutoTools merge the names and numbers arrays into a single array called contacts which will contain each name and number separated by - .


    STEP 3 - SHOWING CONTACTS


    • Add an AutoTools Dialog action
    • Set the Dialog Type to List
    • Set the Title to Contacts
    • Set the Texts to %contacts() (which is the merged array created in the previous action)
    • Set the Commands to %acnumber()
    (i) Setting the Commands to the numbers will make selecting an item on this list return a phone number instead of an entry of the merged array (which will contain both the name and number)


    STEP 4 - TEST SELECTING NUMBER


    • Add a Flash action with the text Selected number %atcommand
    (i) %atcommand will contain the selected command from the dialog which we set to the phone number above

    If you now run the task you'll see all the contacts you selected with their respective phone numbers. If you select one, you'll get the phone number in the %atcommand variable and it'll show in the Flash :cool:


    STEP 5 - OPTIONAL: SHOW THE PHONE NUMBER TYPE


    (i) You may want to show the number type for each number so that you know which number you're selecting

    • In the AutoContacts Query 2.0 action add the Field to Get Phone Number Type
    • In the AutoTools Arrays action add %acnumber_type() in the input and add an extra output with the same name (but with no %)
    • If you now run the task again you'll see that the phone number type will show up on each line in the dialog :cool:

    autormali likes this.

Recent Reviews

  1. SolyomLaszlo
    SolyomLaszlo
    5/5,
    Amazing!
  2. lostmedic
    lostmedic
    5/5,
    this is an awesome project.