Printing and Emailing Billing Documents in Bulk
You can print or email up to 50 Billing Documents at once by using buttons in the list view, and you can print or email up to 1000 Billing Documents at once by using a query which can be scheduled to run automatically. To configure both options, you start by creating a Conga Batch record for each solution. Three solutions are provided:
- Print Billing Document - prints documents to MS Word files
- Print Billing Document PDF - prints documents to PDF files
- Email Billing Document - emails documents to the Billing Contact identified on the Account
Creating Conga Batch Records
You must create Conga Batch records to create formula fields for use by the list view buttons and queries. Repeat these steps for each Conga solution in turn:
- Click the Conga Conductors tab, then click New.
-
Type the Title and Description of the record then click Save. These instructions use the following titles and descriptions:
Title Description
Bulk Print to MS Word Bulk Print Billing Documents to MS Word Bulk Print to PDF Bulk Print Billing Documents to PDF Bulk Email Bulk Email Billing Documents - Click Formula Builder on your record detail page.
- From the Master Object field, select Billing Document.
-
From the Button / Link Name field, select the appropriate Conga Solution then select the relevant Output Mode:
Button Conga Solution Output Mode
Bulk Print to MS Word Print Billing Document Download Bulk Print to PDF Print Billing Document PDF Download Bulk Email Email Billing Document Send via Email -
Under Formula Field, enter an appropriate field name. These instructions use the following formula field names. The URL field names are generated automatically when you create the field.
Button Formula Field Name URL Field Name Bulk Print to MS Word Print Billing Document Print_Billing_Document__c Bulk Print to PDF Print Billing Document PDF Print_Billing_Document_PDF__c Bulk Email Email Billing Document Email_Billing_Document__c - Click Create Field, then Yes to update the record, and OK. Your formula field is now created on the Billing Document object.
- Make a note of each URL Field Name shown in the Master Object Source section because you will need them later.
Modifying the Formula Fields
You now need to set the field-level security for your formula fields so that they are available to users, and make some edits to each formula. Repeat these steps for each of the formula fields you have just created:
- Go to Setup | Create | Objects and select Billing Document.
-
In the Custom Fields & Relationships section, click the field label of your formula field. If you have used the naming conventions in these instructions they will be as follows:
Field Label API Name Print Billing Document Print_Billing_Document__c Print Billing Document PDF Print_Billing_Document_PDF__c Email Billing Document Email_Billing_Document__c - Click Set Field-Level Security.
- On the Set Field-Level Security page, select the Visible checkbox for the user profiles that you want to have access to the field.
- Click Save.
- Still on the Custom Field Definition Detail page, click Edit.
- Scroll down to the last line of the formula.
- Add ' +' to the end of the last line then paste in the three lines shown below:
-
Replace
FIELD_NAMEandFIELD_STATUSwith the details shown below for the appropriate solution.Solution FIELD_NAME FIELD_STATUS Print Billing Document ffaci__CongaPrintStatus__c Printed Print Billing Document PDF ffaci__CongaPrintStatus__c Printed Email Billing Document ffaci__CongaEmailStatus__c Sent - Click Save.
"&UF0=1" + "&mfts0=FIELD_NAME" + "&mftsvalue0=FIELD_STATUS"
By setting the FIELD_NAME and FIELD_STATUS values above, bulk printing from a list view button or query causes the Print Status of a Billing Document to change to Printed, and bulk emailing from a list view button or query causes the Email Status of a Billing Document to change to Sent.
Adding Buttons to the Billing Documents List View
Next create the buttons for the Billing Documents list view. These buttons will use the formula fields you created above. Repeat these steps for each button:
- Go to Setup | Create | Objects and select Billing Document.
- In the Buttons, Links, & Actions section, click New Button or Link.
-
Enter a label and description for the button. The Name field is automatically populated from the label. These instructions use the following labels and descriptions:
Button Label Description
Bulk Print to MS Word Bulk Print Billing Documents to MS Word Bulk Print to PDF Bulk Print Billing Documents to PDF Bulk Email Bulk Email Billing Documents - Set Display Type to List Button and enable Display Checkboxes.
- Set Behavior to Execute JavaScript.
- Set the Content Source as OnClick JavaScript.
- Paste this text into the formula field:
-
Replace
URL_FIELD_NAMEwith the URL Field Name you created earlier. If you have used the naming conventions in these instructions they will be as follows:Button URL_FIELD_NAME Bulk Print to MS Word Print_Billing_Document__c Bulk Print to PDF Print_Billing_Document_PDF__c Bulk Email Email_Billing_Document__c - Click Save.
// BILLING DOCUMENT
var idArray = {!GETRECORDIDS($ObjectType.fferpcore__BillingDocument__c)};
//This is the formula field created earlier
var urlFieldName="URL_FIELD_NAME";
// DO NOT MODIFY ANYTHING BELOW THIS LINE
// YOU MAY PASS UP TO 50 IDS
var CongaURL = "https://conductor.congamerge.com" +
"?MOID=" + idArray +
"&SessionId={!$Api.Session_ID}" +
"&ServerUrl={!$Api.Partner_Server_URL_160}"+
"&UrlFieldName="+urlFieldName;
window.open( CongaURL, "Conga", "width=700,height=450,menubar=0" );
Adding the Buttons to the Search Layout
To make these buttons available in the Billing Documents list view:
- Go to Setup | Create | Objects and select Billing Document.
- In the Search Layouts section, click Edit for the Billing Documents List View.
- Select your new buttons from the Available Buttons list and click the right arrow to move them into the Selected Buttons list.
- Click Save.
Using the Buttons in the Billing Documents List View
You can now use these buttons in the Billing Documents list view.
- Go to the Billing Documents tab and click Go to refresh the page. Your new buttons are visible.
- Select up to 50 documents to print or email, then click either Bulk Print to MS Word, Bulk Print to PDF, or Bulk Email. You receive an error message if you select more than 50 records.
Creating Queries to Print or Email Billing Documents in Bulk
In addition to using the buttons in the Billing Documents list view, you can set up queries to print or email up to 1000 Billing Documents at once, and schedule these queries to run at regular intervals.
The procedures in this section use the following queries:
-
This query selects the first 1000 Billing Documents with the Print Status "Not Printed":
select id, Name from fferpcore__BillingDocument__c where ffaci__CongaPrintStatus__c = 'Not Printed' LIMIT 1000 -
This query selects the first 1000 Billing Documents with the Email Status "Not Sent":
select id, Name from fferpcore__BillingDocument__c where ffaci__CongaEmailStatus__c = 'Not Sent' LIMIT 1000
Up to 1000 Billing Documents will be processed each time the query runs. You can schedule the query to run as frequently as necessary to deal with the volumes generated on your org.
Creating the Conga Queries
To create a Conga query for each of the queries shown above:
- Click the Conga Queries tab, then click New to create a new Conga Query record.
- Enter a Name and Description, then enter the SOQL query for bulk print or bulk email shown above. The sample queries are single lines, therefore remove any line breaks that are inserted when you paste the query into the SOQL Select Statement field.
- Save the query. You can use the Conga Query Builder if you want to build your own query instead of using the samples.
In the next section you need to provide the Salesforce Record ID for the query, so make sure it is visible in the Conga Queries list view.
Attaching the Queries to the Conga Batch records
Now you attach the queries to the appropriate Conga Batch records:
- Attach the bulk email query to the Conga Batch record you created for Bulk Email
- Attach the bulk print query to the Conga Batch record you created for Bulk Print to MS Word or Bulk Print to PDF.
You can attach the bulk print query to both Bulk Print Conga Batch records but typically you will output Billing Documents to one file format or another.
- Click the Conga Conductors tab, then open the appropriate Bulk Print or Bulk Email record.
- Copy the Salesforce Record ID for the bulk print or bulk email query from the Conga Queries list view and paste it into the Query ID field.
- Click Save.
Scheduling Conga Batch records is explained in the Conga Connector for Accounting section, Scheduling Bulk Printing. Follow the instructions in this section to schedule Conga Batch records for both bulk print and bulk email.
SECTIONS