cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Renaming "name" field in Cabinet table

RK_10348291
5-Regular Member

Renaming "name" field in Cabinet table

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

2 REPLIES 2

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

RK_10348291
5-Regular Member
(To:HelesicPetr)

Hi @HelesicPetr ,

 

Thank you for the solution. It works fine now.

 

Thanks.

Top Tags