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

Add custom step only for subtype of wtpart in createpart.jsp

SOLVED

Add custom step only for subtype of wtpart in createpart.jsp

I have a sub type of wtpart called Regulatory Request.

I have added line item table at step 3 in createpart.jsp.

Line item step is showing for all wtpart subtype. I would like to display the step 3 only for regulatory request.

Thanks,

Sithik

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Add custom step only for subtype of wtpart in createpart.jsp

Hi Sithik,

You can follow the below steps

1. Make the wizard step as hidden by default in the custom actions xml file.

e.g.

<action name="test"  preloadWizardPage="false" required="true" hidden="true" >
<component name="test.test" windowType="wizard_step"/>
</action>

2. In the main JSP file using JavaScript function retrieve the type of the object and use below function to display the step at runtime.

  • if (yourtype){
    insertStep(customStepId);

          }

Same mechanism is used on Wtpart details page when you select the checkbox to create a cad document.

Regards,

Bhushan

4 REPLIES 4

Re: Add custom step only for subtype of wtpart in createpart.jsp

Hi Sithik,

You can follow the below steps

1. Make the wizard step as hidden by default in the custom actions xml file.

e.g.

<action name="test"  preloadWizardPage="false" required="true" hidden="true" >
<component name="test.test" windowType="wizard_step"/>
</action>

2. In the main JSP file using JavaScript function retrieve the type of the object and use below function to display the step at runtime.

  • if (yourtype){
    insertStep(customStepId);

          }

Same mechanism is used on Wtpart details page when you select the checkbox to create a cad document.

Regards,

Bhushan

Re: Add custom step only for subtype of wtpart in createpart.jsp

Thanks for pointing this out Bhushan.

I am able to make it work using below steps:

Below is an example of custom JavaScript function:

function customToggleCustomWizardStep(wizardStep) {  
    var ele = element = document.getElementById('!~objectHandle~partHandle~!createType');
    var type = ele.options[ele.selectedIndex].value;
    var desiredPart = "wt.part.WTPart";

    if(type.toLowerCase() === desiredPart.toLowerCase()) {
            // alert(" Inserting Wizard !!! ");
            insertStep(wizardStep);
    } else {
            // alert(" Removing Wizard !!! ");
            removeStep(wizardStep);
    }       
}

And, below is an example of JavaScript function call:

<script language="JavaScript">
    PTC.driverAttributes.on("afterRefresh",function() {
        customToggleCustomWizardStep('CustomActions.customWizardStep');
    });
</script>

Where: CustomActions.customWizardStep is wizard handle.


Thanks,

Shirish

Re: Add custom step only for subtype of wtpart in createpart.jsp

Shirishkumar Morkhade thanks for putting it together.

PTC.driverAttributes.on("afterRefresh",function()  call is actually necessary as we want to hide the step based on the type selected. This is a good addition.

Sithik Rahamedhulla,

Example code from Shirish should be the exact resolution for your query.


Regards,

Bhushan

Re: Add custom step only for subtype of wtpart in createpart.jsp

Hi Bhushan,Shirish,

Thank you for your reply. I am able to add custom step based on the type of WTPart.

Thanks,

Sithik