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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Unable to create a new NmOid for new EPMDocument

MN_10661566
8-Gravel

Unable to create a new NmOid for new EPMDocument

I am using Windchill PDMLink Release 11.0 and Datecode with CPS F000

Creating a new NmOid for a new EPMDocument throws Exception: Cant' initialize an ObjectReference to Null.

Below is our code:
//Creating a new EPMDocument
EPMContextHelper.setApplication(EPMApplicationType.toEPMApplicationType("EPM"));
EPMAuthoringAppType at = EPMAuthoringAppType.toEPMAuthoringAppType("COCRDRAFT");
EPMDocumentType dt = EPMDocumentType.toEPMDocumentType("CADCOMPONENT");
EPMDocument cadDoc = EPMDocument.newEPMDocument("docnumber", "docName", at, dt, "CAD_DOC");
//Now create a new NmOid
NmOid cadNewNmOid = NmOid.newNmOid(cadDoc.getPersistInfo().getObjectIdentifier());

Could you let me know what is the problem here?


Here are the errors that I faced
wt.util.WTRuntimeException: ERROR: Can't initialize an ObjectReference to null

ACCEPTED SOLUTION

Accepted Solutions

Yes. infact newNmOid needs String, and we changed to insert String instead of making EPMDocument persistent.

View solution in original post

2 REPLIES 2

Hi @MN_10661566 

The trouble would be that new EPMDocument is not persisted and the ObjectIdentifier is null that moment?

I would check if getObjectIdentifier really returns somethnig.

 

I usually use oid to create NmOid object> NmOid.newNmOid("OR:wt.part.WTPart:00051210");

 

PetrH

Yes. infact newNmOid needs String, and we changed to insert String instead of making EPMDocument persistent.

Announcements


Top Tags