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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How to add uploadContent / Attachment to column of custom MVC Table

AKC
7-Bedrock
7-Bedrock

How to add uploadContent / Attachment to column of custom MVC Table

Version: Windchill 12.0

 

Use Case:

I have custom MVC table with some pre-defined columns. 

I want to add one more column which is uploadContent i.e, it swould be similar to add attachment so that user should able to browse particular file and add it to this table column


Description:

 

Hello Community,

 

I have custom MVC table with some pre-defined columns. 

I want to add one more column which is uploadContent i.e, it swould be similar to add attachment so that user should able to browse particular file and add it to this table column

1 ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire I
(To:AKC)

Hi @AKC 

Try to analyze following dataUtility

 com.ptc.windchill.enterprise.attachments.dataUtilities.ContentDataUtility

This utility is used in uploading multiple wtDocuments so it can help you I guess

PetrH

View solution in original post

6 REPLIES 6

Hello @AKC

 

Thank you for your question. 
Your question appears to be well documented, however I'd like to recommend to bring more details and context to your initial inquiry. 

It also helps to have screenshot(s) to better understand what you are trying to do in your process. 

This will increase your chances to receive meaningful help from other Community members. 

Thanks & Regards,
Vivek N
Community Moderation Team.

Thanks for the reply Vivek. I agree with your points. Below  is the detailed requirement. 

I have a custom wizard in which I have implemented a custom MVC table with columns like below

AKC_0-1718363703703.png

Here, in this table, I want to include new column which is uploadContent so that for each record user should browse and attach a document 

 

Regards,

Krishna

 

HelesicPetr
22-Sapphire I
(To:AKC)

Hi @AKC 

Try to analyze following dataUtility

 com.ptc.windchill.enterprise.attachments.dataUtilities.ContentDataUtility

This utility is used in uploading multiple wtDocuments so it can help you I guess

PetrH

AKC
7-Bedrock
7-Bedrock
(To:HelesicPetr)

Hello Petr,

 

I could able to get the browse option by using ContentDataUtility. Your input helped me a lot. Thank you!!

 

Regards,

AKC

AKC
7-Bedrock
7-Bedrock
(To:HelesicPetr)

Hi @HelesicPetr ,

 

This is extension to above requirement. I could able to attach documents in custom wizard table column.

AKC_0-1722190544949.png

I can also able to fetch file name which I attached in form processor. However, I have below challenges.

 

1. I am not able to get the location of the file which I attached in form processor. 

2. I can only able to fetch file name, but location ,  HolderLink are coming as  null in forocessor 

(Below is the code I wrote to fetch the attached file in formProcessor sing nmCommandBean)

 

Map<String, String> text = bean.getText();
for (Map.Entry<String, String> entry : text.entrySet()) {
String key = entry.getKey();
filename = entry.getValue();
}
if (filename != null) {
applicationData.setFileName(filename);
applicationData.setRole(ContentRoleType.PRIMARY);
}

 

 

 

2. The attached file, I am trying to set as primary content to newly created documednt type in form processor, it seems attachment's content is not set but only label/filename got set. And because of this,  cannot open it or access to it, I can just able to see file name (label) which I attahed.  I used below code to set file as primary content

 

ExternalStoredData externalData = ExternalStoredData.newExternalStoredData();
externalData.setExternalLocation(locationValue); //This is the location I set manually to specific path
externalData.setDisplayName(labelName);
externalData.setRole(ContentRoleType.PRIMARY);

ContentServerHelper.service.updateContent(absResponse, externalData);
ContentServerHelper.service.updateHolderFormat(doc123);
PersistenceHelper.manager.refresh(absResponse, true, true);

 

AKC_1-1722191654196.png

 

So I actually need file content also on primary content in Document, however I feel I missed some thing in my code wich I am not sure exactly., I need some help on this. 

 

Thanks ,

AKC

Hello @AKC

 

It looks like you have a response from a community member. If it helped you solve your question please mark the reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Community Moderation Team.

Top Tags