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

how to build a custom utility to import BOM?

5-Regular Member

how to build a custom utility to import BOM?


I am building a utility to import BOM in customer format.

Requirement is:--

1. User will upload BOM in CSV format.

2. User can preview CSV in HTML and validate before uploading to windchill.

3. CSV wont be uploaded or lets say BOM wont be uploaded if there is any error in Line item.

4. Result of Upload Process should appear against CSV rows in HTML.

Please suggest.



Hi Rakesh,

so you'll have to identify the part you want to link, export the structures (with expected config) from Windchill and build the part structure in your tool for the display before validation (pre-run).

For building your merged structure (windchill + what you want to import), you'll need some strategy. The most common would be either to replace the existing links, or only add new links...

Something you could consider is whether to create a baseline object from your import or not. It can be usefull to trace which version of the part were imported.



5-Regular Member

Hi Loïc

Thanks for the base line Idea.

I want to build logic only to update usage attributes value for existing link. UsageLink wont be created or deleted.

I cant figure out how to show error result on back to CSV upload page.

Steps are:--

  1. Upload CSV in HTML
  2. Preview and Validate with javaScript for input fields.
  3. Highlight error cells.
  4. How to Disable Ok wizard Button if CSV is not valid.
  5. Ok button will sumit wizard for processing.
  6. How to Highlight or Mark rows with error after Processing in same html load csv page?

Thank in advance for help. 🙂


I don't know whether you already looked at what is available out of the box - Importable spreadsheets - Import from Excel

5-Regular Member

Hi Binesh

we have explored this but we have specific format through which user will update BOM.



The import from spreadsheet functionality is customizable, I believe you can extend this as per your import format instead writing whole new codes.

5-Regular Member

Hi Mohan

can you please share some information on "How to Customize Import from Spread Sheet".


Not sure how much this is going to be helpful to you, but below are OOTB code for the 'Import from Spreadsheet'. It looks complicate to extend but this is the place to start with if it need/can be extended.

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..>

     OwnershipHelper.setOwner(job, SessionHelper.manager.getPrincipal());
     AdminDomainRef admindomainref = myContainer.getDefaultDomainReference();
     ImportJobEvent importjobevent = new ImportJobEvent(ImportJobEvent.CREATED, job);
     ImportExportEventHelper.service.dispatchVetoableEvent(importjobevent, importjobevent.getEventKey());

     job = (ImportJob);

     wt.content.ContentHolder contentHolder = (wt.content.ContentHolder) job;
     ApplicationData applicationData = ApplicationData.newApplicationData(contentHolder);

     ContentServerHelper.service.updateContent(contentHolder, applicationData, filePath);
     job = StandardImportService.importSpreadsheet(job.getPersistInfo().getObjectIdentifier());