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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Checking the Primary Content Extension of Document in windchill Workflow

jayk
5-Regular Member

Checking the Primary Content Extension of Document in windchill Workflow

Hi,

 

Do anyone aware how to check the primary content extension of document, where document is created and processed only  if the primary content is of .ppt or .pptx extension or to throw a exception saying to upload the PrimaryContent as .ppt or .pptx extension and proceed with Document Creation through Workflow, Instead of any customization of FormProcessor's.

 

Thanks in Advance

2 REPLIES 2
AS_10085455
2-Explorer
(To:jayk)

Hi jayk,

 

Just wanted to know if you found the solution to this requirement. Thanks.

 

Best

AS

HelesicPetr
22-Sapphire I
(To:jayk)

Hello,

you can use following code to check primary content file extension. 

 

This code could be used in a transition as a Complete Task 

 Alert message is shown to user if he tries to complete a wf task. 

 

HelesicPetr_0-1641827183570.png

 

 

//primary object has to be type wtDocument
wt.doc.WTDocument wtDoc = (wt.doc.WTDocument) wt.content.ContentHelper.service.getContents((wt.doc.WTDocument) primaryBusinessObject);
wt.content.ContentItem docContent = wtDoc.getPrimary();
if (docContent instanceof wt.content.ApplicationData)
{
//get filename of primary content
java.lang.String filename = (( wt.content.ApplicationData) docContent).getFileName();
if (!filename.endsWith(".pptx") && !filename.endsWith(".ppt")) // if extension is not ppt and pptx
{
// message shown to a user
java.lang.String msg = "the primary file do not contains supported extensions. " + "\n ppt and pptx are supported";
java.lang.Exception exp = new java.lang.Exception(msg);
throw exp;
}
}

 

Announcements


Top Tags