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
Solved! Go to Solution.
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
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