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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

OIR for WTDoc to Specify URL Content

jasonb1
2-Explorer

OIR for WTDoc to Specify URL Content

Is there a way to set up an OIR for a wtDocument where it automatically assigns URL content? If so is it possible to use the new autogenerated document number as a parameter in the URL?

1 REPLY 1
slawson
1-Visitor
(To:jasonb1)

In theory yes, Your main problem is that the URL content can only be stored after the WTDocument is persisted.

Worflow (Recommended)

I would really recommend against this, I would use a cusom workflow that triggers an event just after the 'Start' flag. This method could easily take the WTDocuemnts number and generate a URL, the workflow could then call a method which takes the URL and persists it as secondary content.

OIR (A more interesting approach)

However if you still like the idea of using the OIR the rough guide would be:

Add a 'dummy-attribute' none persisted (NPA) iba/sda attribute to the WTDocument.

Change the WTDocument OIR file and add:

<AttrValue id="dummy-attribute" algorithm="com.ptc.arbortext.windchill.algorithm.CreateUrlContent">

<Attr id="number"/> <!-- maybe the oid as well -->

</AttrValue>

Add a general listener which listens on POST_STORE of the WTDocument.

In the listener retrigger the oir for the 'dummy-attribute'. When retriggered it should rerun the CreateUrlContent and create secondary content now the WTDocument is persisted.

Retrigger the oir in the listener by:

Object value = InitRuleHelper.evaluator.getValue('dummy-attribute', document, containerRef)

In the CreateUrlContent algorithm using the number (or oid if you can get it) test if the WTDocument is persisted. If it is the generate the secondary content

Hope this helps,

-Ste

Announcements


Top Tags