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

How can I automate the "Load From Spreadsheet" action windchill 10.2 M030. Please suggest me API which can be helpful for this....Thanks in advance

Highlighted
Newbie

How can I automate the "Load From Spreadsheet" action windchill 10.2 M030. Please suggest me API which can be helpful for this....Thanks in advance

Please let me know the API to use..

Tags (1)
2 REPLIES 2
Highlighted

Re: How can I automate the "Load From Spreadsheet" action windchill 10.2 M030. Please suggest me API which can be helpful for this....Thanks in advance

Below is used in 10.1, hopefully works in 10.2, if not may need little modifications .

ImportJob job = new ImportJob();
ImportSpec importSpec = new ImportSpec();
WTContainer myContainer = part.getContainer();
ApplicationData appData =<Get you application Data Here, the spreadsheet attached to part/ doc etc..>
     importSpec.setContainerRef(WTContainerRef.newWTContainerRef(myContainer));
     importSpec.setAction(ImportAction.ADD_ONLY);
     importSpec.setPreview(true);
     importSpec.setFilename(appData.getFileName());

     job.setSpec(importSpec);
     job.setStatus(ImportJobStatus.DEFINING);
     OwnershipHelper.setOwner(job, SessionHelper.manager.getPrincipal());
     AdminDomainRef admindomainref = myContainer.getDefaultDomainReference();
     job.setDomainRef(admindomainref);
     job.setContainerReference(WTContainerRef.newWTContainerRef(myContainer));
     ImportJobEvent importjobevent = new ImportJobEvent(ImportJobEvent.CREATED, job);
     ImportExportEventHelper.service.dispatchVetoableEvent(importjobevent, importjobevent.getEventKey());

     job = (ImportJob) PersistenceHelper.manager.save(job);

     wt.content.ContentHolder contentHolder = (wt.content.ContentHolder) job;
     ApplicationData applicationData = ApplicationData.newApplicationData(contentHolder);
     applicationData.setRole(ContentRoleType.PRIMARY);
     applicationData.setFileName(appData.getFileName());

     ContentServerHelper.service.updateContent(contentHolder, applicationData, filePath);
     job = StandardImportService.importSpreadsheet(job.getPersistInfo().getObjectIdentifier());
    
     System.out.println("job status ---> "+job.getStatus().getDisplay());

Highlighted

Re: How can I automate the "Load From Spreadsheet" action windchill 10.2 M030. Please suggest me API which can be helpful for this....Thanks in advance

Hi,

Thanks for helping.

It worrked fine in Windchill 10.2 M030 also.

Announcements