Can we make the Attachment section required?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can we make the Attachment section required?
Hello,
When creating a problem report, can we make the Attachment section required?
Solved! Go to Solution.
- Labels:
-
CAD Data Mgmt
-
Change_Mgmt
- Tags:
- problem report
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The article is for ECR, and I have made the necessary modifications according to your requirements. Please refer to the following steps
Step1:
Unzip the file, place it in your IDE environment (such as Eclipse),be sure to place the Java files in this directory <Windchill_Home>\src\formProcessor, and then compile it. Place the compiled file in this directory Windchill\codebase\formProcessor\SecondaryAttachment.class
If you do not have a IDE, you can also compile it with Windchill, run this commad in Windchill Shell, be sure to place the Java files in this directory <Windchill_Home>\src\formProcessor, a file with the same name will be generated, but the format is class, Place the compiled file in this directory Windchill\codebase\formProcessor\SecondaryAttachment.class
ant -f bin/tools.xml class -Dclass.includes=SecondaryAttachment.java -Dclass.source=%WT_HOME%\src\formProcessor
Step2:
Find Windchill\codebase\config\actions\Custom-actions.xml and add below content
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE listofactions SYSTEM "actions.dtd">
<listofactions>
<objecttype name="attachments" class="wt.content.ContentHolder" resourceBundle="com.ptc.windchill.enterprise.attachments.attachmentsResource">
<action name="attachments_step" uicomponent="ATTACHMENTS" ajax="row" postloadJS="preAttachmentsStep" preloadWizardPage="false">
<command class="formProcessor.SecondaryAttachment" windowType="wizard_step"/>
<includeFilter name="hideFromDTI" />
<includeFilter name="EDACompareFilter" />
</action>
</objecttype>
</listofactions>
Step3:
Restart Windchill and test
Good luck for you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @OnurNalbantgl
OOTB does not have such a function, you need to customize it. Please refer to https://www.ptc.com/en/support/article/CS306962
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
great support.
But I don't know where to apply them.
Where do I apply the sample code?
to an xml in codebase? Or should I define it as an expression within the stream?
Your help will be unforgettable for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Then you need to learn how to customize the Windchill.
CS212271 - Windchill PLM - Customization
CS60345 - Windchill PLM - Customization Guides
PetrH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The article is for ECR, and I have made the necessary modifications according to your requirements. Please refer to the following steps
Step1:
Unzip the file, place it in your IDE environment (such as Eclipse),be sure to place the Java files in this directory <Windchill_Home>\src\formProcessor, and then compile it. Place the compiled file in this directory Windchill\codebase\formProcessor\SecondaryAttachment.class
If you do not have a IDE, you can also compile it with Windchill, run this commad in Windchill Shell, be sure to place the Java files in this directory <Windchill_Home>\src\formProcessor, a file with the same name will be generated, but the format is class, Place the compiled file in this directory Windchill\codebase\formProcessor\SecondaryAttachment.class
ant -f bin/tools.xml class -Dclass.includes=SecondaryAttachment.java -Dclass.source=%WT_HOME%\src\formProcessor
Step2:
Find Windchill\codebase\config\actions\Custom-actions.xml and add below content
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE listofactions SYSTEM "actions.dtd">
<listofactions>
<objecttype name="attachments" class="wt.content.ContentHolder" resourceBundle="com.ptc.windchill.enterprise.attachments.attachmentsResource">
<action name="attachments_step" uicomponent="ATTACHMENTS" ajax="row" postloadJS="preAttachmentsStep" preloadWizardPage="false">
<command class="formProcessor.SecondaryAttachment" windowType="wizard_step"/>
<includeFilter name="hideFromDTI" />
<includeFilter name="EDACompareFilter" />
</action>
</objecttype>
</listofactions>
Step3:
Restart Windchill and test
Good luck for you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
C can not believe my eyes.
Great work. Thank you very much.
I will try this as soon as possible. 🤝
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @Rocket_Max
This is a great solution and it definitely works, but I have to ask something.
Do you think I can do this for a single issue report subtype?
For example, I have 4 problem report type forms. I want to use this obligation only in the ticket type.
Is it possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes it is possible.
You throw an error if the object type is your specific type.
You need to get the information from NmCommandBean and then use a condition if it is your subtype.
PetrH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello, @HelesicPetr @Rocket_Max
Should I add the code I will add here within this field?
Do you have an example for a sub type?
package formProcessor;
import java.util.List;
import com.ptc.core.components.beans.ObjectBean;
import com.ptc.core.components.forms.FormProcessingStatus;
import com.ptc.core.components.forms.FormResult;
import com.ptc.core.components.util.FeedbackMessage;
import com.ptc.netmarkets.util.beans.NmCommandBean;
import com.ptc.windchill.enterprise.attachments.forms.SecondaryAttachmentsSubFormProcessor;
import wt.change2.WTChangeIssue;
import wt.util.WTException;
public class SecondaryAttachment extends SecondaryAttachmentsSubFormProcessor{
@Override
public FormResult preProcess(NmCommandBean commandBean, List<ObjectBean> objectBeans) throws WTException {
System.out.println("Hello PTC");
for ( ObjectBean objectBean : objectBeans ) {
List attachments= objectBean.getAddedItemsByName("attachments.list.editable");
if(objectBeans.size() > 0){
objectBean = objectBeans.get(0);
if(objectBean != null)
{
Object obj = objectBean.getObject();
if(attachments.isEmpty() && obj.getClass().isAssignableFrom(WTChangeIssue.class))
{
FormResult result;
FeedbackMessage errors= new FeedbackMessage();
errors.addMessage("Please add secondary attachments to submit Problem Report form.");
result = new FormResult(FormProcessingStatus.FAILURE);
result.addFeedbackMessage(errors);
return result;
}
}
}
}
return super.preProcess(commandBean, objectBeans);
}
}
