Today’s tutorial starts another series that focuses on Processes and Process Queues. Most of us are quite familiar with establishing CCB processes for a variety of church operational procedures.

Over the next couple of weeks, if not the entire month of March, we’re going to discuss and build some quick tools to help you manage Processes and their respective Queues more efficiently.

Where CCB API falls short with Queues

One of the most long awaited features of the CCB API is being able to mark a person “Done” in a Queue.

If CCB’s API had this one feature, I could program so many of our church’s operational processes to *automagically* work. We could send emails, move persons from one Queue to the next, add/remove persons from Queues and so much more.

But that’s not the case currently although we’ve made mention of it several times via the The Village.

Another place that CCB falls short is managing a person within a Process in its entirety.

I was asked the other day if CCB Process and Queues could limit a person to being added to a process. Our Community Group Pastor (CGP) here at Mosaic Church spends countless hours a week trying to ensure that a person has not been entered into the Community Group Process more than once.

For example, a person completes a Community Group card on February 1st and they’re added to the Community Group Follow Up Process. A week or so passes and the person is moving from Queue to Queue per protocol but has not completed the process in its entirety.

Then February 15th, the person completes another Community Group card. Now they’re entered back into the Community Group Follow Up Process for a second time. Now we have the same person in two different Process Queues in the same process.

Again, our CGP and team spends countless hours going from Queue to Queue to make sure that there are no duplicate persons in the queue.

Little did our CGP realize that I had run into the same issue for our Membership Class and Foundations Class, yet I wrote a script that creates a report of each person that is in multiple process queues in the same process.

I simply have this CSV/Excel report emailed each week to my inbox. I check it and make the necessary adjustments for each profile and process queues included in the report.

And that’s what you’re going to learn to do over the next couple of weeks in this tutorial series. Today we’ll start out with how to retrieve a list of queues for a given process. So, let’s get started.

Setting up variables to retrieve process and list of queues

Open the text editor of your choice, and create and save a file name named process-queues.php. Be sure to add the necessary header comments and just like in previous tutorials, don’t forget to include the config.php file.

Now it’s time to define the apiService and processID variables. Set the value of the apiService variable to queue_list, the CCB API service that retrieves a list of process queues for a given process.

Next, you’ll need to identify which process queue you’re going to create this report from. In this tutorial, the process id I’m using is 14, which is the process id for our Community Group process.

To find the id of the Process you’ve chosen, you’ll need to login to your CCB account, and select More and then Process Queues from the left hand menu as show below.

Find Process Queues

 

Next, you’ll find the Process you’ll use and click it to view it. Once at the selected Process page, look at the url in your web browser (shown below), and find and identify the number that follows process_id=. Again, the process id I’m using in this example is 14, which is our Community Group process.

Find CCB Process ID

 

Once you’ve identified your Process’ id, define a processID variable and set the value equal to the respective process’ id.

Time to bind labels and variables, and make CCB API call

Next on the list of things to do is creating the urlData variable comprised of an array of blinded service API labels and variables encapsulated by the array_filter function.

And just like previous tutorials, define the rss variable and assign it the ccbDetails function with get as the first argument and urlData as the second argument.

The ccbDetails function will return an XML response upon successfully completing the curl call. Take this XML response and parse it using XPATH query and the following XPATH query expression: //queues/queue.

Now define a nodes variable and assign it the rss variable that references the XPATH query statement.

Parsing the data for display

As we prepare to parse and access the data for viewing to the web browser, we’ll define the response_object variable.

Then, using the nodes variable array response, create a foreach statement to iterate over each of the Process Queues and their respective data points.

From within the foreach statement, define the response_object and use the .= operator to concatenate each Queue’s name, id and sort order. Append a <br/> html tag to make for a better viewing of data.

Finally, close the foreach loop and echo the response_object to the web browser screen. Save the file and open it using your web browser. Congrats, you should now see a list of queues for the process you’ve chosen.

<?PHP

/**
 * process and queues
 */

// contains resusable globals and functions
include("includes/config.php");

$apiService = 'queue_list'; // CCB api service
$processID = '14'; // Process ID

$urlData = array_filter( array(
	'srv' => "$apiService",
    'id' => "$processID",
	) );

$rss = ccbDetails('get',$urlData); // transform to XML

$nodes = $rss->xpath('//queues/queue');  // xpath for process queues

$response_object = '';

foreach ($nodes as $node)
{
	$response_object .= $node->name." (ID: ".$node['id'].") - ".$node->order."<br/>";
}

echo $response_object;

?>

 

That does it for the first part of this series. Next week, we’ll focus on how to retrieve a list of individuals within each Queue.

Feel free to drop a comment or two should you need assistance, or would like to give your input. That’s all for now. See you next week.

Related Posts

Subscribe and receive the following...

  • Inside CCB tips and tricks
  • Instant CCB tutorial alerts and updates
  • CCB How To's, Videos, Webinars and more...