Skip to main content
1-Visitor
November 6, 2017
Question

Upload a file for a WTDocument from Thingworx

  • November 6, 2017
  • 0 replies
  • 784 views
var params = {
 infoTableName : "InfoTable",
 dataShapeName : "demo.wt.doc.WTDocument"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(ptc-demoProblemReportShape)
var newDocument = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
newDocument.AddRow({
 name: "TestDocument1",
 number: "000001",
// 'state--state': "Released",
// 'versionInfo--identifier--versionId': "A",
 type: "wt.doc.WTDocument",
 containerReference: "OR:wt.inf.container.ExchangeContainer:5:219321006-1506495753013-268599241-1-56-168-192@blrmaigwd27067.itcinfotech.com",
 'folderingInfo--cabinet': "OR:wt.folder.Cabinet:280:219321006-1506495753013-268599241-1-56-168-192@blrmaigwd27067.itcinfotech.com"
});
var params = {
 dataShape: 'demo.wt.doc.WTDocument' /* DATASHAPENAME */,
 objects: newDocument /* INFOTABLE */
};
// result: INFOTABLE dataShape: "undefined"
var createdDocument = me.Create(params);

var result = createdDocument;

With this service i'm able to create the WT Document in windchill. But i can't succeed in attaching a file to this document. Should i add the file as one of the properties of the document?

Please provide a methodology for my requirement.

 

Thanks and Regards
SaranKarthick