---
title: "Work Order PDF"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/4948459549/Work%20Order%20PDF"
format: markdown
---
> ⚠️ Work Order PDF is provided AS IS. Guide below applies to the default Work Order PDF feature that is being distributed with every new FieldBuddy environment. 
> ⚠️ 
> ⚠️ Work Order PDF something that is being maintained or updated by FieldBuddy, but by implementation partners by changing the unmanaged code. It could also be the case that some of the layouts or features or settings are changed by the implementation partner

## Introduction

A Work Order PDF is a functionality that generates an overview of the Work Order in PDF format.

This feature allows sending a summary of the work that has been done, the total amount it will cost and including which parts have been used. This PDF can also be sent to the customer's e-mail address that has been stored in the Work Order. 


## What is the Work Order PDF

Work Order PDF is a functionality that generates an overview of the Work Order in PDF.

This feature allows to configure and send a summary of the work that has been done, and the total amount it will cost, and other things. To configure it, some development may be required. This will be sent to the customers e-mail that has been stored in the Work Order level

Work Order PDF is provided “as is” in unmanaged state, therefore you are able to modify it the way you want.

![image](media://f127e044-a232-41f2-80c7-732ccccb77c2)

> ℹ️ How it works in a nutshell – as soon as work order status (FIELDBUDDY__Status__c) is changed from **not closed** (OPEN, IN_PROGRESS and so ) to **closed** (CLOSED or CANCELLED),  and there is a signature attached to work order, and  and appropriate custom settings are enabled , work order may be generated and (if generated) emailed.  
> ℹ️ For email being sent – there should be Email (un) , (Email_UN__c) field specified at Work Order object

## How is it being distributed

Work Order PDF is distributed in a format of unmanaged metadata (VF page, component, controller, trigger and custom settings) that is provided in a default environment of FieldBuddy.

It is provided AS IS

It can be modified during implementation phase by changing code, but it is not something that will be updated by FieldBuddy, but by implementation partners

## Metadata Components

1. Web service that generate an pdf content class + tests
  1. `cls_WorkOrderPDFController`
  2. `cls_WorkOrderPDFWebService`
  3. `test_WorkOrderPDFWebService`
2. 2 helping components to display number and controllers for them - **LocalDateTime, LocalNumber **components
3. Main VF component to render PDF - **WorkOrderPDF** component
4. VF page to display component - **WorkOrderPDF** page
5. Trigger that execute a WS to fetch pdf body and fire's workflow (**tr_WO_pdf**)
6. Workflow that send email with pdf to end user
7. Email template used by trigger (unmanaged,  classic)
8. Custom settings (**unmanaged** fields on object `FIELDBUDDY__FieldbuddySettings__c` except for the logo )
9. Fields on Work Order to track progress and determine if PDF is generated/emailed at work order level
10. Static resource with style - `WorkOrderPDF_css` static resource

## Settings 

There are following settings being used in Work Order PDF module

All fields below are unmanaged except for he logo

| Label/Value | **Api Name** | Action |
| --- | --- | --- |
| SC PDF: Logo Resource Name | `FIELDBUDDY__SC_PDF_LogoResourceName__c` | Logo that is being used by default. If it is empty – then Static resource with name `FieldBuddyLogo` is being used |
| SC PDF: Generate PDF UN False | `SC_PDF_GeneratePDF__c` | PDF would not be generated in any case |
| SC PDF: Generate PDF UN - True, SC PDF: Generate PDF Based On WO = false | `SC_PDF_GeneratePDFBasedOnWO__c` | PDF would be generated in any case regardless checkboxes on WO |
| SC PDF: Generate PDF UN - True, SC PDF: Generate PDF Based On WO = true | `SC_PDF_GeneratePDFBasedOnWO__c` | PDF would be generated in case if field on Work Order calledGenerate WO PDF Email Attachment is set to true (`Generate_WO_PDF_Email_Attachment_UN__c`) |
| SC PDF: Email To Customer UN - false | `SC_PDF_EmailToCustomer__c` | Email would not be send |
| SC PDF: Email To Customer UN - True, SC PDF: Email To Customer Based On WO = false, and PDF is generated | `SC_PDF_EmailToCustomerBasedOnWO__c` | Email would be send regardless checkboxes on WO |
| SC PDF: Email To Customer UN - True, SC PDF: Email To Customer Based On WO = true, and PDF is generated | `SC_PDF_EmailToCustomerBasedOnWO__c` | Email would be send in case if feild on WO called Send WO PDF Email To Customer is set to true (`Send_WO_PDF_Email_To_Customer_UN__c`) |

### Options matrix

| Label | SC PDF: Generate PDF UN | SC PDF: Generate PDF Based On WO UN | SC PDF: Email To Customer UN | SC PDF: Email To Customer Based On WO UN | Generate WO PDF UN | Send WO PDF UN | Result |
| --- | --- | --- | --- | --- | --- | --- | --- |
| **Object** | `FIELDBUDDY__FieldbuddySettings__c` | `FIELDBUDDY__FieldbuddySettings__c` | `FIELDBUDDY__FieldbuddySettings__c` | `FIELDBUDDY__FieldbuddySettings__c` | `FIELDBUDDY__Work_Order__c` | `FIELDBUDDY__Work_Order__c` |  |
| API | `SC_PDF_GeneratePDF__c` | `SC_PDF_GeneratePDFBasedOnWO__c` | `SC_PDF_EmailToCustomer__c` | `SC_PDF_EmailToCustomerBasedOnWO__c` | `Generate_WO_PDF_Email_Attachment_UN__c` | `Send_WO_PDF_Email_To_Customer_UN__c` | **if PDF is saved**<br>**If email is sent** |
| 1 | FALSE | ANY | ANY | ANY | ANY | ANY | NO PDF, NO EMAIL |
| 2 | TRUE | FALSE | FALSE | ANY | ANY | ANY | PDF, NO EMAIL |
| 3 | TRUE | FALSE | TRUE | FALSE | ANY | ANY | PDF, EMAIL |
| 4 | TRUE | FALSE | TRUE | FALSE | ANY | ANY | PDF, EMAIL |
| 5 | TRUE | FALSE | TRUE | TRUE | ANY | FALSE | PDF, NO EMAIL |
| 6 | TRUE | FALSE | TRUE | TRUE | ANY | TRUE | PDF, EMAIL |
| 7 | TRUE | TRUE | FALSE | ANY | FALSE | ANY | NO PDF, NO EMAIL |
| 8 | TRUE | TRUE | FALSE | ANY | TRUE | ANY | PDF, NO EMAIL |
| 9 | TRUE | TRUE | FALSE | ANY | TRUE | ANY | PDF, NO EMAIL |
| 10 | TRUE | TRUE | TRUE | FALSE | TRUE | ANY | PDF, EMAIL |
| 11 | TRUE | TRUE | TRUE | TRUE | TRUE | FALSE | PDF, NO EMAIL |
| 12 | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE | PDF, EMAIL |


# What to do in case of problems

1. If WO PDF does not work, you need to do following checks
  1. Ensure that there is license assigned to a user that want to save it
  2. Ensure that **cls_WorkOrderPDFController** and **cls_WorkOrderPDFService** are available to end users by permission set or apex classes permissions
  3. All parent lookups are given at Work Order, Service Request, Installed Product, Location and Account level
  4. Settings are properly set according to settings matrix above
  5. Preview WO PDF for given work order by URL `/apex/WorkOrderPDF?id=<work order id>`
2. Code of WO PDF is unmanaged. You can do some changes to run that under your very own conditions, but then it is your responsibility to ensure that it works. Given guide is applied to default WO PDF version
3. In case if there are no signature – WO PDF is not generated. if there are multiple signature files – WO PDF will pick random one
4. Go to Apex Jobs in Setup. Check if there are any errors there

> ℹ️ Click [here](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5357928449) if you want to learn more about editing fields on the Work Order PDF