Create Objects of user-defined subclass – not working
Hi All,
I followed the documentations and tried to create a “change” that belongs to a user defined sub-class, but it is not working. Do you have any idea why?
IAdmin admin = iAgileSession.getAdminInstance();
IAgileClass iAgileClass = admin.getAgileClass("User define agile class");
Integer classId = (Integer) iAgileClass.getId();
IChange change = (IChange) iAgileSession.createObject(classId, changeNumber);
I throws an exception but I can’t see the exact error yet, it’s another issue, probably some maven dependency missing. If I try to create an MCO or ECO it is working well (with IDs as well)
IChange change = (IChange) iAgileSession.createObject(ChangeConstants.CLASS_MCO, changeNumber);
2.8.2.2 Creating Objects of User-Defined Subclasses
User-defined subclasses are classes created specifically for your Agile PLM system. Consequently, the Agile API doesn’t provide predefined class ID constants for them. To specify a user-defined subclass for the objectType
parameter of createObject()
, pass an Integer corresponding to the class ID. To get the class ID for a user-defined class, use the IAgileClass.getId()
method. Thanks, Feri
Do you have any “Required” fields set up for the User-Defined subclass? As in fields that need to be entered on the “Create New” screen of the web-client? If so, you would need to pass a map of parameters with each required field value (instead of “changeNumber”in the createObject()) to get the object created