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

We are aware of an issue causing pages to load incorrectly for some users and expect a fix soon. Sorry for the inconvenience.

Translate the entire conversation x

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

SriTalatam
12-Amethyst

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

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!

ACCEPTED SOLUTION

Accepted Solutions
SriTalatam
12-Amethyst
(To:Imad_A)

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. 

View solution in original post

6 REPLIES 6
Imad_A
12-Amethyst
(To:SriTalatam)

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

SriTalatam
12-Amethyst
(To:Imad_A)

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()'

Imad_A
12-Amethyst
(To:SriTalatam)

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

 

SriTalatam
12-Amethyst
(To:Imad_A)

May i know if you tried this with multi step wizard?
I just used the above code (looks you took the <script> piece from the result response? ) you shared and still the same old behavior. Additionally, are you on WC 13.0 ?

Imad_A
12-Amethyst
(To:SriTalatam)

Yes, I tested this with a multi-step wizard as well.

Regarding the version, I’m currently working on WC 12.1, not 13.0.

SriTalatam
12-Amethyst
(To:Imad_A)

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. 

Announcements
Top Tags