Skip to main content
12-Amethyst
December 14, 2025
Solved

Could not have the Wizard(s) display banner and close upon successfully calling the processor class

  • December 14, 2025
  • 1 reply
  • 290 views

Implementing a custom wizard in Windchill that will eventually create a WTPart and establish some associations. The process involves a multi-step wizard defined in custom-actions.xml and managed by a final form processor.

FormResult Message:
<script>
top.PTC.getMainWindow().PTC.messaging.showInlineMessage
([{"MessageTitle":"CONFIRMATION:",
"Messages":["Repair Kit generated successfully with number: C1000"],"MessageType":"SUCCESS"}]);
top.PTC.getMainWindow().PTC.performance.stopComponentTimer('WizardSubmit');
top.handleSubmitResult(0, 1, ' ', '\x20', {"extraData":{}})
</script>
While the expectation is to show a banner message or just close the windows, it just goes back to a refreshed parent wizard. 
Console Error:
Uncaught TypeError: Cannot read properties of undefined (reading 'getMainWindow')

Approaches Tried:

Various things have been tried including sending the feedbackmessage explicitly, redirecting to the URL manually. PFA for detailed explanation. Any feedback is appreciated. Thank you!

Best answer by SriTalatam

It is the JSP location. Moving all the pages to the netmarkets folder resolved the issue. 

As quoted in the customization guide:

"Windchill will expect all jsp pages related to this object type to be located in \codebase\netmarkets\jsp\"

Thank you @Imad_A for the support. 

1 reply

13-Aquamarine
December 15, 2025

I implemented a similar solution by overriding setResultNextAction in the FormProcessor.
You can adapt the snippet below to your own context. Hope this helps.

@Override
public FormResult setResultNextAction(FormResult result, NmCommandBean clientData, List<ObjectBean> objects)
throws WTException {

FormResult retval = super.setResultNextAction(result, clientData, objects);
String js = "top.opener.reloadTable(top.opener.PTC.jca.table.Utils.getTable(\"adhocTable\"));window.close();";
retval.setJavascript(js);
retval.setNextAction(FormResultAction.JAVASCRIPT);
return retval;
}


Regards,

iaarab

12-Amethyst
December 15, 2025

Thank you for the response.

I tried this in the processor class along with the doOperation() and issue persists.

Whenever the 'result' is being handled, it just fails to decipher the response, esp 'top.PTC.getMainWindow()'

13-Aquamarine
December 15, 2025

It works fine on my side by overriding setResultNextAction() and returning a FormResultAction.JAVAscript &colon; 

@Override
public FormResult setResultNextAction(FormResult result, NmCommandBean clientData, List<ObjectBean> objects)
throws WTException {

FormResult retval = super.setResultNextAction(result, clientData, objects);

String js = "top.PTC.getMainWindow().PTC.messaging.showInlineMessage ([{\"MessageTitle\":\"CONFIRMATION:\","+
"\"Messages\":[\"Repair Kit generated successfully with number: C1000\"],\"MessageType\":\"SUCCESS\"}]);"+
"top.PTC.getMainWindow().PTC.performance.stopComponentTimer('WizardSubmit');"+
"top.handleSubmitResult(0, 1, ' ', '\\x20', {\"extraData\":{}})";

retval.setJavascript(js);
retval.setNextAction(FormResultAction.JAVASCRIPT);
return retval;
}

Imad_A_0-1765812676840.png