Skip to main content
5-Regular Member
January 12, 2023
Solved

Renaming "name" field in Cabinet table

  • January 12, 2023
  • 2 replies
  • 1815 views

Hello,

 

I am trying to rename the "Name" field in Cabinet table using code. However I am facing an error while doing so. Does anyone have any suggestion on how to proceed in this? I am attaching the code snippet and the error that I am facing.

 

Any help would be highly appreciated.

 

Thanks,

Ramsha Kamal

Best answer by HelesicPetr

Hi @RK_10348291 

if a object is persisted it is not possible to change a identity directly on the object. 

 

You need to use  IdentityHelper.service.changeIdentity 

 

Example>

		Cabinet cabinetFolder = null; // you need to search for the cabinet , null is just used for demonstration purpose

		CabinetIdentity cabinetIdentity = (CabinetIdentity) cabinetFolder.getIdentificationObject();
		try
		{
			cabinetIdentity.setName("new Name");
		} catch (WTPropertyVetoException e)
		{
			e.printStackTrace();
		}

		try
		{
			IdentityHelper.service.changeIdentity(cabinetFolder, cabinetIdentity);
		} catch (WTException e)
		{
			e.printStackTrace();
		}

 

PetrH

2 replies

HelesicPetr
22-Sapphire II
January 12, 2023

Hi @RK_10348291 

if a object is persisted it is not possible to change a identity directly on the object. 

 

You need to use  IdentityHelper.service.changeIdentity 

 

Example>

		Cabinet cabinetFolder = null; // you need to search for the cabinet , null is just used for demonstration purpose

		CabinetIdentity cabinetIdentity = (CabinetIdentity) cabinetFolder.getIdentificationObject();
		try
		{
			cabinetIdentity.setName("new Name");
		} catch (WTPropertyVetoException e)
		{
			e.printStackTrace();
		}

		try
		{
			IdentityHelper.service.changeIdentity(cabinetFolder, cabinetIdentity);
		} catch (WTException e)
		{
			e.printStackTrace();
		}

 

PetrH

5-Regular Member
January 13, 2023

Hi @HelesicPetr ,

 

Thank you for the solution. It works fine now.

 

Thanks.