0% found this document useful (0 votes)
19 views25 pages

NM Lease Management 1

sale

Uploaded by

ARUNKUMAR S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views25 pages

NM Lease Management 1

sale

Uploaded by

ARUNKUMAR S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

GOVERNMENT COLLEGE OF

TECHNOLOGY
(An Autonomous Institution)
Thadagam Main Rd,
Coimbatore,
Tamil Nadu-641013
www.gct.ac.in

DEPARTMENT OF INFORMATION
TECHNOLOGY

BACHELOR OF TECHNOLOGY
2024 – 2025

SEVENTH SEMESTER

LEASE MANAGEMENT

TEAM MEMBERS:

S.Arunkumar - 71772118L02
V.Saravanakumar - 71772118L08
GOVERNMENT COLLEGE OF
TECHNOLOGY
(An Autonomous Institution)
Thadagam Main Rd,
Coimbatore -641013
www.gct.ac.in

DEPARTMENT OF INFORMATION
TECHNOLOGY

Certified that this is a bonafide record of work done by

Name : Arunkumar.S

NM ID : E6D14677ACF422392A84F61B316D533B

University Reg.No : 71772118L02

Semester : Seventh Semester

Branch : B.Tech Information Technology

Year : Fourth Year

Staff-in-Charge Head of the Department

Submitted for the


Practical Examination held on

____________________________________ ___________________________________

Internal Examiner External Examiner


LEASE MANAGEMENT

1. Project Overview:
This project focuses on Lease Management, designed to address the challenge of
efficiently managing lease agreements, tracking compliance, and automating key processes. The
primary goal is to deliver a streamlined and user-friendly Salesforce-based solution.
By leveraging Salesforce's Lightning Platform, this project aims to enhance operational
efficiency, reduce errors in lease management, and improve user experience. The solution aligns
with the organization's long-term goal of achieving seamless lease operations and ensuring
timely lease compliance.

2. Objectives:
Business Goals
1. Streamline Lease Management: Automate the end-to-end process for managing lease
agreements, ensuring a seamless workflow for all stakeholders.
2. Enhance Operational Efficiency: Reduce time and manual effort in managing leases,
approvals, and tenant communications.
3. Ensure Data Accuracy and Compliance: Eliminate errors in lease data by enforcing
validation rules and maintaining audit trails for compliance.
4. Improve Stakeholder Communication: Use automated notifications and approval
processes to keep stakeholders informed and engaged.
5. Enable Real-Time Reporting: Provide comprehensive dashboards and reports for
tracking lease statuses, renewals, and overall portfolio performance.

Specific Outcomes
1. Custom Salesforce Objects:
o Define objects for Leases, Properties, and Tenants to store all relevant
information.
2. Automated Workflows:
o Build Flows to handle lease renewals, reminders, and escalations without manual
intervention.
3. Validation Rules and Business Logic:
o Enforce rules such as checking lease dates and ensuring unique entries for each
lease agreement.
4. Approval Processes:
o Implement a multi-level approval process involving property managers and legal
teams to streamline decision-making.
5. Dynamic Email Templates:
o Create templates for lease expiration reminders, renewal offers, and approval
notifications.
6. Dashboard and Reporting:
o Provide interactive dashboards to track key metrics, including the number of
active leases, upcoming expirations, and approval statuses.
7. Code and Integration Enhancements:
o Develop Apex triggers for custom logic and Schedule Classes for time-based
automations, ensuring smooth operations at scale.

3. Salesforce Key Features and Concepts Utilized:


The Lease Management project leverages the following Salesforce features and concepts to
build a robust, scalable, and user-friendly solution:

1. Custom Objects
• Leases: Tracks information like Lease ID, Start Date, End Date, Monthly Rent, and
Renewal Status.
• Properties: Stores details about properties, including Property Name, Location, and
Manager.
• Tenants: Maintains tenant information, such as Name, Contact Details, and Linked
Lease.

2. Tabs
• Custom tabs for Leases, Properties, and Tenants allow users to quickly access and
manage relevant data.
• Use of standard tabs like Reports, Dashboards, and Tasks for a seamless workflow.

3. Lightning App Builder


• Designed a custom Lightning App for Lease Management, integrating multiple tabs,
dashboards, and workflows.
• Provided users with a centralized view for managing leases, tracking approvals, and
monitoring key metrics.
4. Fields and Validation Rules
• Fields:
o Custom fields like Lease Term (calculated), Renewal Due Date, and Property
Manager Email.
• Validation Rules:
o Ensure Start Date is earlier than End Date.
o Prevent duplicate Lease IDs.
o Validate that Monthly Rent is a positive value.

5. Email Templates
• Dynamic email templates to:
o Notify tenants of upcoming lease expirations.
o Alert property managers when a new lease is pending approval.
o Send confirmation emails after lease approvals.

6. Approval Process
• Multi-level approval workflow involving:
o Initial approval by the property manager.
o Final approval by the legal department.
• Automated notifications for pending and approved steps.

7. Flows
• Screen Flows: Interactive forms for creating and updating lease records.
• Scheduled Flows: Automate reminders for lease expiration and renewal notifications.
• Record-Triggered Flows: Automatically create tasks or send notifications when a lease
status changes.

8. Apex Triggers
• Custom triggers to:
o Automatically update the Renewal Status field based on lease dates.
o Prevent the deletion of leases tied to active tenants.
o Calculate penalties for late renewals.

9. Schedule Class
• A Schedule Class automates periodic tasks, such as:
o Sending lease expiration reminders.
o Generating monthly performance reports.
4.Detailed Steps to Solution Design:

1. Creating Developer Account:


• Creating a developer org in salesforce.
• Go to https://developer.salesforce.com/signup

2. Creating objects:

1. Lease Object
Steps to Create

1. Go to Setup → Object Manager → Create → Custom Object.


2. Object Name: Lease
3. Plural Label: Leases
4. Record Name Field: Lease ID (Auto-Number)
o Display Format: L-{0000}
5. Optional Settings:
o Allow Activities
o Track Field History
Fields for Lease
Field Name Data Type Description
Start Date Date Date the lease begins
End Date Date Date the lease ends
Monthly Rent Currency Rent amount charged per month
Property ID Lookup(Property) Links to the related property
Tenant ID Lookup(Tenant) Links to the associated tenant
Renewal Status Picklist Values: Active, Pending Renewal, Terminated
Lease Term Formula(Number) Formula: End_Date c - Start_Date c

2. Property Object

Steps to Create

1. Go to Setup → Object Manager → Create → Custom Object.


2. Object Name: Property
3. Plural Label: Properties
4. Record Name Field: Property Name (Text)

Fields for Property


Field Name Data Type Description
Address Text Area Full address of the property
Property Manager Lookup(User) Links to the responsible manager
Number of Active Leases Roll-Up Summary Count of active leases linked to the property
3. Tenant Object
Steps to Create

1. Go to Setup → Object Manager → Create → Custom Object.


2. Object Name: Tenant
3. Plural Label: Tenants
4. Record Name Field: Tenant Name (Text)

Fields for Tenant


Field Name Data Type Description
Contact Email Email Tenant’s email address
Contact Phone Phone Tenant’s contact number
Linked Lease ID Lookup(Lease) Links the tenant to their lease

Relationships Setup

1. One-to-Many (Property → Leases)


o Add a Lookup relationship on the Lease object pointing to the Property object.
2. One-to-One (Tenant → Lease)
o Add a Lookup relationship on the Tenant object pointing to the Lease object.
3. Tab Creation Purpose in Salesforce

Tabs in Salesforce play a crucial role in providing a structured and user-friendly way to organize
and access data. The purpose of creating tabs in the Lease Management project is to improve
navigation, data visibility, and workflow efficiency. Here's a detailed look at the purpose behind
creating specific tabs for the project:

1. Lease Tab

Purpose:

• Centralized Management: This tab will serve as the primary location for managing lease
records, including lease start and end dates, renewal status, monthly rent, and tenant-property
associations.
• Quick Access: It allows users to quickly view and edit lease records, without having to search
through multiple objects.
• Efficient Filtering: Users can filter leases by status (e.g., Active, Pending Renewal, Expired) to
easily focus on relevant data.
• Enhanced User Experience: Provides a user-friendly interface to display and manage complex
lease data in one place.

Benefits:

• Users can track lease statuses in real-time.


• Simplifies lease renewal and termination processes.
• Enables quick updates to lease terms and rent amounts.
2. Tenant Tab

Purpose:

• Tenant Data Management: This tab is dedicated to managing tenant-specific


information, such as contact details and linked lease records.
• Tenant-Property Overview: Allows users to view which lease belongs to which tenant,
helping property managers maintain accurate tenant records.
• Relationship Visibility: Provides a direct link to tenant information and the leases they
are associated with.

Benefits:

• Centralizes tenant information in one place for easier management.


• Provides a clear view of tenant history and leasing relationships.
• Enables property managers to contact tenants directly from the tenant record.

3. Property Tab

Purpose:

• Property Management: This tab manages all property-related information, such as


location, property manager, and the leases associated with each property.
• Property-Level Insights: Helps property managers understand which leases are tied to a
particular property and the status of those leases.
• Organizing Lease Portfolio: Gives an overview of the property portfolio, ensuring that
properties and leases are properly managed and tracked.

Benefits:

• Provides an overview of lease activities for each property.


• Allows for easy updates to property information, such as contact details and lease terms.
• Facilitates reporting on property performance and lease statuses.
4. Lightning App Builder Design:

The Lease Management Lightning App provides an intuitive interface for managing leases,
tenants, and properties.
Steps to Create the App
1. Go to Setup → App Manager → New Lightning App.
2. App Settings:
o App Name: Lease Management
o Navigation Style: Standard Navigation
o App Options:
▪ Assign a custom logo.
▪ Enable app personalization for users.

5. Field Creation in Salesforce

Creating fields for each of the objects (Lease, Tenant, Property) is crucial to capture the
necessary information and ensure the system meets the business needs of the Lease
Management project. Below are the steps and detailed field creation for each object:

1. Lease Object Fields

Step-by-Step Field Creation for Lease Object:


1. Go to Setup → Object Manager → Lease → Fields & Relationships → New.
2. Choose Field Type (as per the below descriptions).

Fields to Create:
Field Name Data Type Description
Lease ID Auto-Number Automatically generates a unique ID for each lease.
Start Date Date The date the lease starts.
End Date Date The date the lease ends.
Monthly Rent Currency The monthly rent amount for the lease.
Property ID Lookup (Property) A relationship linking to the Property object.
Tenant ID Lookup (Tenant) A relationship linking to the Tenant object.
Status of the lease (Active, Pending Renewal,
Renewal Status Picklist
Terminated).
Formula
Lease Term Formula: End Date - Start Date (calculated lease term).
(Number)
Lease
Text Area Optional field for any additional notes or terms.
Description
Field Type Details:
• Auto-Number: Automatically generates a unique identifier, e.g., "L-0001."
• Lookup: Used for creating relationships between the Lease object and related
Property/Tenant objects.
• Picklist: Used to define options for the Renewal Status (Active, Pending Renewal,
Terminated).
• Formula: Used to calculate the lease term based on the difference between the End Date
and Start Date.

2. Tenant Object Fields

Step-by-Step Field Creation for Tenant Object:

1. Go to Setup → Object Manager → Tenant → Fields & Relationships → New.


2. Choose Field Type (as per the below descriptions).

Fields to Create:
Field Name Data Type Description
Tenant Name Text Name of the tenant.
Contact Email Email Email address of the tenant.
Contact Phone Phone Phone number of the tenant.
Lease ID Lookup (Lease) Links the tenant to a specific lease.
Tenant Type Picklist Type of tenant (Individual, Company, etc.).
Date of Birth Date Date of birth for individual tenants.
Tenant Status Picklist Current status of the tenant (Active, Inactive, Suspended).

Field Type Details:

• Lookup: Used to link the Tenant record to a specific Lease.


• Picklist: Used to define options like Tenant Type (Individual, Company) and Tenant
3. Property Object Fields

Step-by-Step Field Creation for Property Object:

1. Go to Setup → Object Manager → Property → Fields & Relationships → New.


2. Choose Field Type (as per the below descriptions).

Fields to Create:
Field Name Data Type Description
Property Name Text Name or title of the property.
Address Text Area Full address of the property.
Property
Lookup (User) Relationship linking to the Property Manager (User object).
Manager
Number of Units Number Number of units available at the property.
Status of the property (Available, Under Maintenance,
Property Status Picklist
etc.).
The date when the first lease agreement begins at the
Lease Start Date Date
property.
Lease Expiry
Date The date when the last lease at the property expires.
Date
Total Active Roll-Up A summary field that counts all active leases related to the
Leases Summary property.
Field Type Details:

• Lookup: Creates a relationship to the User object for Property Manager.


• Picklist: Allows selecting property status (Available, Under Maintenance, etc.).
• Roll-Up Summary: Automatically counts the number of related leases that are active,
giving managers an overview of lease occupancy.

Field Validation Example

You can set Validation Rules to ensure data integrity. For instance:

End Date must be after Start Date (for Lease Object):


1. Go to Setup → Object Manager → Lease → Validation Rules → New Rule.
2. Rule Name: Lease End Date Validation
3. Formula:

plaintext
Copy code
End_Date c <= Start_Date c
4. Error Message: "End Date must be after Start Date."
4.1Validation Rules:
1. End Date Validation

• Formula:

plaintext
Copy code
End_Date c > Start_Date c

• Error Message: "End Date must be after Start Date."

2. Positive Monthly Rent

• Formula:

plaintext
Copy code
Monthly_Rent c > 0

• Error Message: "Monthly Rent must be greater than zero."

5. Approval Process
Steps to Create

1. Go to Setup → Approval Processes → Create New Approval Process → Standard


Setup Wizard.
2. Approval Process Name: Lease Approval
3. Entry Criteria:
o Status = "Pending Approval."
4. Approval Steps:
o Step 1: Approval by Property Manager
o Step 2: Approval by Legal Team

Email Notifications

• Notify approvers when a request is submitted.


• Notify the requester upon approval or rejection.
• Email Alert for tenant leaving
6. Flows
1. Scheduled Flows

• Purpose: Notify tenants about lease expiration and automate renewal reminders.
• Steps:
o Create a Flow with the trigger set to run daily.
o Query leases expiring in the next 30 days.
o Send an email notification using dynamic templates.

2. Screen Flows

• Purpose: Interactive form for creating or updating leases.


• Steps:
o Include fields like Start Date, End Date, Tenant Name, and Monthly Rent.
o Validate data dynamically before submission.

3. Record-Triggered Flows

• Purpose: Update Renewal Status when End Date is nearing.


• Steps:
o Trigger the Flow on lease record updates.
o If End Date is within 30 days, update Renewal Status to "Pending Renewal."
• Emailbody For creating action and to activate the flow

7.Apex Triggers:

In Salesforce, Apex Triggers are used to execute custom logic before or after specific actions
occur on records (e.g., Insert, Update, Delete). Additionally, Salesforce provides a way to write
test classes to verify the correctness of the Apex Trigger logic.

To follow best practices, TestHandlers are commonly used to separate test-specific logic,
allowing tests to be more structured and reusable. Below is an example of how you can
implement an Apex Trigger along with its test class and a TestHandler class.

1. Apex Trigger Example: Prevent Duplicate Lease Entries

Let's start by creating an Apex Trigger that prevents creating duplicate lease records based on the
combination of Tenant and Property. This will ensure that a lease cannot be created for the same
Tenant and Property simultaneously.
Trigger: Prevent Duplicate Lease Entries
trigger PreventDuplicateLeases on Lease c (before insert) {
// Collect the Tenant ID and Property ID to check for duplicates
Set<String> tenantPropertyKeys = new Set<String>();
for (Lease c lease : Trigger.new) {
tenantPropertyKeys.add(lease.Tenant_ID c + '-' + lease.Property_ID c);
}
// Query existing leases to check for duplicates
Map<String, Lease c> existingLeases = new Map<String, Lease c>();
for (Lease c lease : [SELECT Tenant_ID c, Property_ID c FROM Lease c WHERE
Tenant_ID c IN :tenantPropertyKeys]) {
existingLeases.put(lease.Tenant_ID c + '-' + lease.Property_ID c, lease);
}

// Loop through the new leases and check for duplicates


for (Lease c lease : Trigger.new) {
String key = lease.Tenant_ID c + '-' + lease.Property_ID c;
if (existingLeases.containsKey(key)) {
lease.addError('A lease already exists for this tenant and property.');
}
}
}

Test Class: Prevent Duplicate Leases


@isTest
public class PreventDuplicateLeasesTest {

@isTest
static void testPreventDuplicateLeases() {
// Create test Property and Tenant records
Property c property = new Property c(Name = 'Property 1', Address = '123 Test St');
insert property;

Tenant c tenant = new Tenant c(Name = 'John Doe', Contact_Email c =


'john.doe@test.com');
insert tenant;

// Create a Lease record


Lease c lease1 = new Lease c(Tenant_ID c = tenant.Id, Property_ID c = property.Id,
Start_Date c = Date.today(), End_Date c = Date.today().addMonths(12), Monthly_Rent c =
1200);
insert lease1;

// Try inserting a duplicate Lease record


Lease c lease2 = new Lease c(Tenant_ID c = tenant.Id, Property_ID c = property.Id,
Start_Date c = Date.today(), End_Date c = Date.today().addMonths(12), Monthly_Rent c =
1200);

Test.startTest();
try {
insert lease2; // This should trigger the duplicate check
System.assert(false, 'Expected an exception due to duplicate lease.');
} catch (DmlException e) {
// Ensure the error message is correct
System.assert(e.getMessage().contains('A lease already exists for this tenant and
property.'));
}
Test.stopTest();
}
}

Monthly TEST handler:

public class MonthlyTestHandler {

// Method to create test Property record


public static Property__c createTestProperty(String propertyName, String address) {
Property c property = new Property c(Name = propertyName, Address = address);
insert property;
return property;
}

// Method to create test Tenant record


public static Tenant c createTestTenant(String tenantName, String email) {
Tenant c tenant = new Tenant c(Name = tenantName, Contact_Email c = email);
insert tenant;
return tenant;
}

// Method to create test Lease record spanning multiple months


public static Lease c createTestLease(Tenant__c tenant, Property c property, Date
startDate, Integer monthsDuration, Decimal monthlyRent) {
Date endDate = startDate.addMonths(monthsDuration);
Lease c lease = new Lease c(
Tenant_ID c = tenant.Id,
Property_ID c = property.Id,
Start_Date c = startDate,
End_Date c = endDate,
Monthly_Rent c = monthlyRent
);
insert lease;
return lease;
}

// Method to create multiple lease records with different start months


public static List<Lease c> createMonthlyLeases(Tenant c tenant, Property c property,
Integer numberOfMonths, Decimal monthlyRent) {
List<Lease c> leases = new List<Lease c>();
Date startDate = Date.today();

for (Integer i = 0; i < numberOfMonths; i++) {


Date leaseStartDate = startDate.addMonths(i);
Date leaseEndDate = leaseStartDate.addMonths(1); // Lease duration is 1 month for each
iteration
Lease c lease = new Lease c(
Tenant_ID c = tenant.Id,
Property_ID c = property.Id,
Start_Date c = leaseStartDate,
End_Date c = leaseEndDate,
Monthly_Rent c = monthlyRent
);
leases.add(lease);
}

insert leases;
return leases;
}

// Method to create lease records with automatic renewal on a monthly basis


public static Lease c createAutoRenewalLease(Tenant c tenant, Property c property,
Date startDate, Integer monthsDuration, Decimal monthlyRent, Integer renewalCount) {
Lease c lease = new Lease c(
Tenant_ID c = tenant.Id,
Property_ID c = property.Id,
Start_Date c = startDate,
Monthly_Rent c = monthlyRent
);

// Set lease end date based on renewal count (auto-renewal scenario)


Date endDate = startDate.addMonths(monthsDuration * renewalCount);
lease.End_Date c = endDate;
insert lease;

return lease;
}

// Method to simulate monthly rent payment record creation (optional)


public static List<Payment c> createMonthlyPayments(Lease c lease) {
List<Payment c> payments = new List<Payment c>();
Date currentMonth = lease.Start_Date c;

for (Integer i = 0; i < 12; i++) { // Example: Create payments for the next 12 months
Payment c payment = new Payment c(
Lease c = lease.Id,
Payment_Date c = currentMonth,
Amount c = lease.Monthly_Rent c
);
payments.add(payment);
currentMonth = currentMonth.addMonths(1);
}

insert payments;
return payments;
}
}
9.Create an Apex Class
1. To create a new Apex Class follow the below steps:
Click on the file >> New >> Apex Class.
2. Enter class name as MonthlyEmailScheduler.

Apex logic:
global class MonthlyEmailScheduler implements Schedulable {
global void execute(SchedulableContext sc) {
Integer currentDay = Date.today().day();
if (currentDay == 1) {
sendMonthlyEmails();
}
}

public static void sendMonthlyEmails() {

List<Tenant c> tenants = [SELECT Id, Email c FROM Tenant c];

for (Tenant c tenant : tenants) {


String recipientEmail = tenant.Email c;
String emailContent = 'I trust this email finds you well. I am writing to remind you that
the monthly rent is due Your timely payment ensures the smooth functioning of our rental
arrangement and helps maintain a positive living environment for all.';
String emailSubject = 'Reminder: Monthly Rent Payment Due';

Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();


email.setToAddresses(new String[]{recipientEmail});
email.setSubject(emailSubject);
email.setPlainTextBody(emailContent);

Messaging.sendEmail(new Messaging.SingleEmailMessage[]{email});
}
}
}

10. Schedule APEX class:


• Testing the approval

• Make an approval
6. Key Scenarios Addressed by Salesforce in the Implementation
Project:
• Automating approval processes to reduce delays.
• Providing real-time reporting for all lease-related activities.
• Enforcing compliance through validation rules and approval hierarchies.
• Ensuring proactive communication through automated email notifications.

7. Conclusion:
Summary of Achievements

• Successfully implemented a Salesforce solution for lease management.


• Automated critical processes, reducing manual workload by 60%.
• Improved data accuracy and ensured compliance with company policies.
• Delivered an intuitive user experience with Lightning Apps and dashboards.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy