How to change an application's acronym
In the case that an applicationβs acronym needs to be changed, a script will need to be run against an offline deployment of Swimlane. The script is a Python script. Save the below into ChangeAcronym.py:
import pymongo
import ssl
# ID of Application to change acronym on
appId = "aDwSZk8eyBt_GhZz4"
# The current app acronym
oldAcroynm = "IR1"
# The new app acronym that will replace the old acronym NO MORE THAN 4 CHARACTERS
newAcronym= "ADM"
# The address of the MongoDB server
mongoServer = "localhost"
# The port of the MongoDB server (27017 is default port)
mongoPort = 27017
# Username to authenticate to MongoDB as
mongoUser = "Admin"
# Password for MongoDB user
mongoPass = "<password>"
# MongoDB database that stores the user account we are authenticating as
mongoAuthDatabase = "admin"
mongoAuthMechanism = "SCRAM-SHA-256"
database = pymongo.MongoClient(host=mongoServer, port=mongoPort, username=mongoUser, password=mongoPass,
authSource=mongoAuthDatabase, authMechanism=mongoAuthMechanism, ssl=True,
ssl_cert_reqs=ssl.CERT_NONE).Swimlane
app = database.Applications.find_one({"_id": appId})
if app is None:
print("Application not found")
quit()
trackingFieldId = app['TrackingFieldId']
app['Acronym'] = newAcronym
for field in app['Fields']:
if field['_id'] == trackingFieldId:
field['Prefix'] = newAcronym + '-'
database.Applications.save(app)
for record in database.Records.find({"ApplicationId": appId}):
new_tracking_full = record['TrackingFull'].replace(oldAcroynm, newAcronym)
record['TrackingFull'] = new_tracking_full
record['Name'] = new_tracking_full
for value in record['Values']:
if value['k'] == trackingFieldId:
new_tracking_full_value = {'_v': {'v': new_tracking_full}}
value['v'] = new_tracking_full_value
record['ValuesDocument'][trackingFieldId] = new_tracking_full
database.Records.save(record)
How to use the script properly:
- Shut down the Swimlane services
- Update the variables at the top of the script to match your environment.
- Execute the python script:
python ChangeAcryonym.py
- Turn Swimlane services back online
- Verify the acronym change in Swimlane
The application should now be changed.