BigTime offers a variety of preset fields you can add to time and expense sheets, but you can also create your own custom fields. If you want these fields to appear on time and expense invoices, you’ll need to follow the steps below to create a custom invoice template and add the field by using BigTime’s API document. In this example, you’re going to add a custom timesheet field you created to an invoice template.
1. To start, make sure you’ve created a custom field and filled it out while logging time. If you don’t know how to do this, read this article. In this case, let's call this custom field “Location”.
2. Once you’ve logged time using your custom field, you’ll need to create a new invoice PDF template by going to INVOICING…CONFIGURE…PDF STYLES and clicking CREATE NEW.
Label this invoice template as “Original”.
To cover your bases, return to your PDF STYLES window and create a copy of this "Original" template. Label this new template as “XML”.
This new copied template you create will be the one you’ll add your custom field to later on. As you make edits to your invoice in XML, you can refer back to this original invoice template to make sure you don’t miss or drop any important fields.
3. After saving your custom invoice PDF template, you’ll need to create a report that records your custom field. Since you’ll be invoicing based on your timesheet in this example, you’re going to create a Timesheet Detail report. Adjust your report columns so that the report only contains your custom field – in this case, Location.
4. Keep your report window open, and in a new window open BigTime’s API document. Find the section labeled MAKING API CALLS, located at the bottom of the GETTING CONNECTED page. Here, you’ll see a field marked REST URL.
5. Next, you’ll enter the URL for your report following this format: report/detail/{your report id}
To learn more about structuring your report detail call, take a look at the Reports section of the API document. This section explains how BigTime’s reporting API works and the ways it can be used to edit your report’s settings.
6. Underneath the REST URL field, you’ll now see a string of code.
Within this code, find the code that displays the ID and NAME of your custom field.
The NAME will be the same name you created for your field in BigTime, but the ID is what you’ll need to take note of. Copy this ID and return to the page where you edit details about your Custom Field Template (XML). Scroll to the bottom of the page, and under the SOURCE VIEW section, click CONVERT TO SOURCE ONLY.
7. Clicking this link will display the XML source code for your invoice template.
Remember, you logged time with your custom field and recorded that custom field in a timesheet detail report. Because of this, you’ll need to scan this source code and find the Data Table for “timesummary”.
8. Here, you’ll see a list of all the field labels on your invoice, each one marked as “fld label”. This is where you’ll add the NAME and ID from the code you pulled in BigTime’s API document. Follow this format when writing your code: <fld label=”name”>copied ID</fld>. For this example, the code will look like:
<fld label=”Location”>Tmudf_location</fld>.
9. After adjusting the source code for your invoice template, click SAVE.
Now, when you create an invoice with this custom invoice template, your custom Location field will appear in the invoice’s PDF preview. Below is an example of what that might look like.