Is there an API call available which could automatically create address labels?
This could be very handy with CiviRules, to have an automatic API-action to create address labels overnight.
CiviCRM Stack Exchange is a question and answer site for administrators and users of the CiviCRM Constituent Relationship Management software. It only takes a minute to sign up.Sign up to join this community
It depends what you mean by "API". If it's a script you're going to run overnight you could do something like this and put it in a file, let's say
<?php $form = new CRM_Contact_Form_Task_Label(); // Array of contact ids - could get this from wherever. $form->_contactIds = array(2,3,4); $params = array( 'label_name' => 3475, 'location_type_id' => NULL, 'do_not_mail' => 1, ); $form->postProcess($params);
Then run the script with
cv scr --user=admin labels.php > output.pdf
Or some variation of that. There's some trickiness to capturing the output within the script if you didn't want to redirect to a file - you'd either have to duplicate a lot of code or rely on something that is internally used for unit tests and could disappear.