Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
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
Hi jayk,
Just wanted to know if you found the solution to this requirement. Thanks.
Best
AS
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.
//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;
}
}