Skip to main content
1-Visitor
January 12, 2015
Solved

Object Initialization Rules

  • January 12, 2015
  • 1 reply
  • 6435 views

Hi,

I create a document subtype named "DocsRef" What I'm trying to do is when you create a document under "DocsRef" The default folder shoul be "DOCUMENTS"

I create OIR and this is my code.

<AttributeValues objType="wt.doc.WTDocument">

<AttrValue

id="folder.id"

algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm"

ignore="false"

force="false"

final="false">

<Arg>/wchill://Windchill/Product/Projects/Documents/</Arg>

</AttrValue>

</AttributeValues>


After that I create new rules and named it DocsRef and I choose DocsRef type and upload the xml file with the code above.

When I try to create new document under DocsRef type. I received this error.

Untitled.png

can somebody tell me what is the cause of the error?

Thanks!

Luar

Best answer by mrane

Hi Luar,

The exception clearly states that the folder does not exist. Note the folder needs to exist before you create the document and expect to save it in the folder. Consider the OIR entry as shown below :

'Default' needs to exist and the folder ABC is the folder in which I need to store the documents. It is the first level folder.

<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">

<Arg>/Default/ABC</Arg>

</AttrValue>

-Malavika

1 reply

mrane1-VisitorAnswer
1-Visitor
January 12, 2015

Hi Luar,

The exception clearly states that the folder does not exist. Note the folder needs to exist before you create the document and expect to save it in the folder. Consider the OIR entry as shown below :

'Default' needs to exist and the folder ABC is the folder in which I need to store the documents. It is the first level folder.

<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">

<Arg>/Default/ABC</Arg>

</AttrValue>

-Malavika

Luar1-VisitorAuthor
1-Visitor
January 12, 2015

Hi Malavika,

Thankyou for prompt response. The error is gone but what I want to do is the path in Select Folder should be the folder path where I want my file to store. Or can I set the radio button default on Auto select Folder?

Untitled.png

Thanks,

Luar

1-Visitor
January 12, 2015

In the OIR file, you would already have the <AttrConstraint id="folder.id".....

Replace it with the following snippet:

<AttrConstraint id="folder.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

<Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>

</AttrConstraint>

-Malavika