---
title: "Troubleshooting renaming leases and agreements in LeaseControl"
canonical: "https://servicedesk.maxgeo.com/space/LC/1263239351/Troubleshooting%20renaming%20leases%20and%20agreements%20in%20LeaseControl"
format: markdown
---
<u>**Problem**</u>

1. When attempting to rename a lease in LeaseControl I get one of the following errors:
  - "This lease/agreement ID is already in use" - refer **Troubleshooting 3** onwards.
  - Other error regarding a foreign key constraint and my LeaseControl version is 1.5.1 or higher - refer **Troubleshooting 1**.
2. I can't access the buttom [Rename] - refer **Troubleshooting 2**.

<u>**Troubleshooting**</u>

1. Check if a custom table or view has been added that uses the Lease_ID as a foreign key constraint.
  - If you require assistance determining which are custom tables/views - contact [servicedesk.maxgeo.com](http://servicedesk.maxgeo.com) noting that we will require access to a copy of your database.
  - If the answer is yes - refer **Solution 1**.
2. Is the Edit Mode button showing OFF and coloured red?
  - If No - refer **Cause 3.**
  - If Yes - refer **Cause 4.**
3. Check both archived and non-archived Leases ***and*** Agreements for an ID matching the one the tried to use.
  - Yes, but it is a Lease and I am renaming an Agreement (or vice versa) - refer **Cause 1**.
  - Yes there is an existing ID matching this one - refer **Cause 1**.
  - No - refer **Cause 2**.
  - NOTE: Please also refer **DBA Instructions 1** further down this article.

<u>**Cause**</u>

1. Lease and Agreement IDs are require to be unique - including between these 2 modules (that is, a Lease ID cannot match an Agreement ID and vice versa).  In this case you have tried to breach this rule - refer **Solution 2**.
2. The system retains a memory of previous Lease and Agreement IDs.  For example, if you had ELA1234 and renamed it EL5678, then tried to enter another record as ELA1234 you won't be able to.  Never fear though, we can assist you - refer **Solution 3**.
3. Something is not quite sitting right although this is not a usual problem.  I'm sorry I don't more information but if it keeps happening please let us know via [servicedesk.maxgeo.com](http://servicedesk.maxgeo.com).  We may need to review the .exe in use. - refer **Solution 4**.
4. You need to have Edit Mode turned ON (and therefore green) to be able to use this function - refer **Solution 5**.

<u>**Solution**</u>

1. The stored procedure in SQL (LMS_RenameLeaseID_SP) that renames the Lease_ID field in all the associated tables needs to be updated to include the custom tables.
  - Please ensure you read the important information in related article "Managing Modifications to the LeaseControl system".
2. Either:
  - Use a different ID; or
  - If the old record relates to the same matter you may want to consider using the existing record; or
  - If it relates to a record that is not longer applicable and you wish to have this record removed from the LeaseControl system contact [support@maxgeo.com](mailto:support@maxgeo.com) noting this cannot be undone once implemented.  We will require access to a copy of your database to do this.
3. Either:
  - Use a different ID; or
  - If you want to have this record removed from the LeaseControl system contact[servicedesk.maxgeo.com](http://servicedesk.maxgeo.com) noting this cannot be undone once implemented.  We will require access to a copy of your database to do this.
4. Close and reopen LeaseControl.  if it persists, please contact us via [servicedesk.maxgeo.com](http://servicedesk.maxgeo.com)
5. Turn Edit Mode ON by clicking on the button (which is currently red) then re-try.  If you can't turn Edit Mode ON and:
  - ...you are using a browser licence - please be advised you have no editing rights under this licence and therefore can't perform the stating function among others.  To change your licencing please contact [sales@maxgeo.com](mailto:sales@maxgeo.com).
  - ...you are using an admin licence and populate your database via the Exporter application
  - ...none of the above apply or you are unsure if you are running and admin or browser licence - please contact [servicedesk.maxgeo.com](http://servicedesk.maxgeo.com) noting that we require your licence key and information on what software and database version is running.  If you are unsure, please refer related articles "[What version of LeaseControl am I using?](https://maxgeo.atlassian.net/wiki/spaces/LC/pages/1263370286)"

<u>**DBA Instructions**</u>

*This is for suitably trained and qualified SQL personnel, noting that no changes should ever be made to data or standard tables/views/stored procedures/jobs etc. other than by way of a Maxwell GeoServices LeaseControl script.*

1. To verify if the ID is currently or formerly in use - from the table LMS_DBAUDT_DatabaseAudit look for the ID the user is trying to apply in:
  - DBAUDT_NewValue where DBAUDT_FieldName = 'TENEMT_ID' or 'AGRMNT_Number' (if this returns a positive result, the ID is currently a Lease or Agreement ID respectively) - refer **Cause 1**.
  - DBAUDT_OldValue where DBAUDT_FieldName = 'TENEMT_ID' or 'AGRMNT_Number' (if this returns a positive result, the ID is a former name for a current Lease or Agreement ID respectively) - refer **Cause 2**.