Skip to main content
14-Alexandrite
Question

Inline Messaging customization

Hi.

How to add link to primary content in ObjectFormProcessor feedback message?

I want user to have a link to pdf file in inline message.

Thanks.

6 replies

15-Moonstone

The following code provides the primary content download URL.

import wt.content.ApplicationData

import wt.content.ContentHelper

import wt.content.ContentRoleType

import wt.doc.WTDocument

import wt.fc.QueryResult

// Initialize from somewhere...

WTDocument doc;

doc = (WTDocument) ContentHelper.service.getContents(doc); QueryResult queryResult = ContentHelper.service.getContentsByRole(doc,ContentRoleType.PRIMARY);

URL url=null; if(queryResult.hasMoreElements()){    // There can be only one...     url = ContentHelper.getDownloadURL(doc, (ApplicationData) queryResult.nextElement());

} // Test url, if it's null, no content.

// Otherwise, add it in the feedback message, within an <a href="url">downloadPrimary</a>

Translate
14-Alexandrite

olivier fresse написал(а):

The following code provides the primary content download URL.

// Otherwise, add it in the feedback message, within an <a href="url">downloadPrimary</a>

Thanks, but the question is "how to add url to feedback message".

And the question is relevant for windchill version 11.

Translate
15-Moonstone

ok,

in your processor, you have a doOperation method. It returns a FormResult object. :

replace the "message" string with the html code to download the content, it should be ok.

import com.ptc.core.components.beans.ObjectBean

import com.ptc.core.components.forms.FormResult

import com.ptc.core.components.util.FeedbackMessage

import com.ptc.core.ui.resources.FeedbackType

import com.ptc.netmarkets.util.beans.NmCommandBean

FormResult doOperation(NmCommandBean nmCommandBean, List<ObjectBean> objectBeans) {

  FormResult formResult = super.doOperation(nmCommandBean, objectBeans);

   // do the job...


   formResult.addFeedbackMessage(

   new FeedbackMessage(

  FeedbackType.SUCCESS,

  nmCommandBean.getLocale(),

   "Title",

   null,

   "message"));

   return formResult;

}

Translate
14-Alexandrite

It works in windchill 10, but it does not in windchill 11.

HTML tags do not work, they looked like text in message.

inline message html.png

Translate
15-Moonstone

Hmm I see, same thing with workflow activities.

There is probably an html tag filtering to prevent xss attacks

Not sure it can be bypassed

Translate