One of the Projects I am working on, I have a requirement to rename the file name while uploading it to the SharePoint document library.
The flow is as follows: Basically the Document library has a lookup column called Entity ID so when a user clicks on Upload in the document library, he or she will select the document to upload from their local machine, hit ok and then will select Entity ID(lookup column) from the drop-down as its a mandatory field to be populated. Lastly user will hit on Checkin button and the document will be uploaded.
Let's say the File Name user uploaded was as: "Accounting Info" and Entity ID was "11055", Now when the user hits on CheckIn, I want to rename the file name by appending the selected entity id at the end of the file name. So the replaced file name would look like: "Accounting Info 11055".
I want to achieve this using JSOM only since I am working with Office365/SharePoint online. Can someone please help me with the JSOM code to accomplish this? Many Thanks in Advance.