Hi,
Expense Report is one of the most common forms that almost any organization needs. You want to be able to quickly and easily report your business expenses and then route the form for approval. You would not believe how many places, even today, still use pen and paper, Excel or Word documents! Not everyone has the skills and the knowledge to build a robust modern solution for this common need.
But with SharePoint it's all so much easier. It's a great collaboration platform that is designed from the ground up to handle data and processes in shared, multi-user environment, while still preserving the necessary security restrictions. SharePoint out of the box is a great starting point for many business solutions and a lot can be done using SharePoint Designer or custom development. However, it's not always easy to build something slightly more advanced. For instance, multiple line items within the expense report or dynamic routing (when the approver is set dynamically based on the department) are certainly challenges that might have you scratching your head.
In this blog I will provide you with step-by-step instructions on how to build a real life expense report, complete with an approval stage. I will be using our product, Ultimate Forms, to add the necessary extra on top of regular SharePoint lists to make sure the process works exactly how I need it to work.
Basically, we will be implementing the following:
- Being able to create a new expense report. Some of my information, such as my name, will be automatically pre-filled.
- The line items can be added directly within the New form of the expense report, no save is necessary to start adding the line items
- Summary is automatically calculated based on the line items
- Manager for approval is automatically determined by selecting the appropriate department
- Manager will receive a notification in email with a link to the expense report. For extra credit we can even implement email-based approvals!
- Once the expense report is approved or rejected, the employee is notified.
Our finished form will look something like this:
Cool, right? :)
So let's start! I will be using the Office 365 add-in version of Ultimate Forms, but you can do exactly the same on premises as well.
Creating Lists
In SharePoint, our data is stored in lists, so we will need several lists for our Expense Report soluition.
- Departments
This list will contain the various departments our employees belong to. It will then be used as a lookup source for our Department column in the Expense Reports list. We will start with a regular Custom list and just add one column of type Person or Group and call it Manager. It will hold the manager for the department - Line Items
This list will contain the line items for the expense report. We will start by create a new Custom list. To allow the parent and the child lists to create and maintain a relationship, we will need to replace the default Item content type with our special Infowise Associated Item content type. It contains a set of special hidden columns that allow us to create the relationship between the child and the parent items. To replace the content type do the following:- Go to List Settings
- Go to Advanced Settings
- Choose Yes for Allow management of content types (the first option on the page)
- Save
- Under List Settings you will now see a new section for managing content types. Click on "Add from existing site content types".
- Select "Infowise Associated Item" content type and save
- Back on List Settings, click on Item content type and then delete it from the list
Next, we will configure the list columns:- Rename Title to Details
- Add a choice column Expense Type and fill th choices you want (such as Fare, Lodging, Meals, Entertainment, etc.)
- Add a date colum Date
- Add a currency column Amount
- Expense Reports
The main list holding all the data regarding the expense reports, excluding the line items. Start by creating a new Custom list. Now let's configure the columns: - Rename Title to Report ID
- Add a date column Date, you can set the default to Today
- Using Ultimate Forms add a new User Property column named Employee Name. It will be used to automatically prefill the submitter's name. In the Office 365 add-in version, you can use the following formula: [FirstName] [LastName]. In the on-premises version you can do the same to fetch the data from SharePoint Profile service, or, if using Foundation, directly from Active Directory: [givenName] [sn]
- Add a lookup column Department using the Departments list, make it required
- Add a text column Location (to specify where the expenses took place)
- Add date columns Start Date and End Date
- Using Ultimate Forms add a new Associated Items column named Items. It will point to our Line Items list and use the Infowise Associated Items content type
- Using Ultimate Forms add a new Associated Items Summary column named Subtotal. It will calculate a Sum of the Amount column in Items
- Add a currency column Advance, set the default to 0
- Add a calculated column Total, using the formula =Subtotal-Advance, set the display format to Currency
- Add a choice column Approval Status, add choices N/a, Approved and Rejected, make it required and make sure N/a is the default
- Add a date column Approval Date
- Add a multiple lines of text column Approval Comments
That's it, all our lists are created, so we can start turning them into an actual business application.
Configuring Forms
Well, we actually just need to configure one form, the Expense Report itself.
First, let's configure automatic numbering for Report ID. This way each report will have a unique identifier. I used the format EXR-<submitter name>-<year>-<numerator>, but you can use any other format you like.
- Go to Expense Reports list
- On the List ribbon click on Ultimate Forms' Design button
- Under Configure Business Logic click on Item IDs
- Add a new rule for Report ID column. Set it to run on New item and check Prevent manual editing. Under Pattern enter: EXR-[Employee Name]-$Year([Created])-[#]
- Save
Next, let's configure the tabs and tab permissions. This will ensure users can only update the information they are allowed to.
- Go to Expense Reports list
- On the List ribbon click on Ultimate Forms' Design button
- Under Configure Layouts and Permissions click on Tabs and tab permissions
- Add a new tab Expenses
- Under Tab-column Association pick the following columns to appear on the tab:
- Employee Name
- Date
- Department
- Add section: Trip Details
- Start Date
- End Date
- Location
- - Blank Row -
- Items
- - Blank Row -
- Subtotal
- - New Row -
- Advance
- - New Row -
- Total
- Under Tab Permissions add the following rules:
Permission level For users/groups Default Apply in forms Conditions Write New Read Edit;View Write Edit Approval Status equals N/a - Add a new tab Approval
- Underr Tab-column Association pick the following columns to appear on the tab:
- Approval Status
- Approval Date
- Approval Comments
- Under Tab Permissions add the following rules:
Permission level For users/groups Default Apply in forms Conditions Deny (hidden) New Read Edit;View Write Column: Department -> Manager Edit Approval Status equals N/a - Under General Settings choose Modern theme, Label location: Above field, Description location: Under field and Columns: 2
- For extra credit, let's apply custom styling to the form to make it really stand out. You can make use of the styles described in this article. Or, in Office 365, you can now import the style from this file (right-click as Save As).
Configuring Alerts
With the forms done, now it's time to configure some alerts. We are going to be adding 2 alerts, one to inform the manager that an expense report has been submitted and the other one to inform the submitter regarding the outcome of the approval.
Alert #1
- Go to Expense Reports list
- On List ribbon click on Add Alert button
- Under Recipients remove yourself from To box
- Click the plus button to add a new recipient
- Under Users in column select Department and then in the additional selector - Manager
- Under What to send clear everything but Item is added
- Under Mail Templates create your own email template, it can contain text, column values and special functions (such as Edit Item link)
- Save the alert
Alert #2
- Go to Expense Reports list
- On List ribbon click on Add Alert button
- Under Recipients remove yourself from To box
- Click the plus button to add a new recipient
- Under Users in column select Created By
- Under What to send clear everything by Item is modified
- Under Conditions add Approval Status after change not equals N/a - that will make sure the alert is only sent when an approval decision is made
- Under Mail Templates create your own email template, it can contain text, column values and special functions
- Save the alert
That's it! Your Expense Report system is ready for action!