Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
I can use the code below to get the container name without any query, but I want to use it in the notification template and present it to the user as a direct link to the root folder of that container, anybody knows a way to get this link?
“A goal without a plan is just a wish.”
Guilherme,
You can use below code to get the URL for container
com.ptc.netmarkets.model.NmOid contentOid = new com.ptc.netmarkets.model.NmOid((WTObject) container);
urlFactoryBean.setRequestURI(com.ptc.netmarkets.util.misc.NetmarketURL.BASEURL);
Thanks,
Hello Shreyas,
Thank you for your prompt answer, you code looks sharp!
I get this other solution from PTC and I am posting it here just to increase the information of the forum, what do you think of this technique, do you see any issue?
package ext;
import wt.fc.ObjectIdentifier;
import wt.fc.PersistenceHelper;
import public void Exception
{
ObjectIdentifier oidIdentifier = new ObjectIdentifier("wt.pdmlink.PDMLinkProduct:13422");
wt.pdmlink.PDMLinkProduct pn= (wt.pdmlink.PDMLinkProduct)PersistenceHelper.manager.refresh(oidIdentifier);
.println("object id getObjectIdentifier : "+pn.getPersistInfo().getObjectIdentifier());
System.out.println("object id getPersistInfo: "+pn.getPersistInfo());
System.out.println( pn. getIdentity
String partoid= "OR:"+pn.toString();
System.out.println("OID: "+pn.getPersistInfo().getObjectIdentifier());
com.ptc.netmarkets.util.misc.NmAction action = com.ptc.netmarkets.util.misc.NmActionServiceHelper.service.getAction("object","view",Locale.ENGLISH);
if ( action == null ) throw new Exception ( "Unable to get action" );
action.setWindowType("page");
action.setContextObject ( com.ptc.netmarkets.model.NmOid.newNmOid ( partoid ) );
String url = action.getActionUrlExternal();
System.out.println("URL: "+url);
http://ptcsupport2d1.ptcnet.ptc.com:81/Windchill/servlet/TypeBasedIncludeServlet?oid=OR%3Awt.pdmlink.PDMLinkProduct%3A13422&u8=1
Thank you in advance!
Guilherme Rocha