cancel
Showing results for 
Search instead for 
Did you mean: 

Using Document Templates and Setting Keywords

Paul_Hoecherl
Confirmed Champ
Confirmed Champ

I have an app that needs to store user responses to a web-based questionnaire.

 

The main workflow of the application page is walking users through a series of questions, and when completed programmatically generate a PDF (based on a PDF Template stored in OnBase) , set the keywords, and Save to OnBase.

 

The result should be stored as a completed PDF in OnBase, complete with keywords.

(I have created the necessary DocumentType and keywords in OnBase, and added a Template of that DocType to the system.)

 

This workflow is fine until I get to setting the 3 keywords it needs, and saving a new document.

After saving to OnBase the pre-defined DocumentType Keywords are blank, and three new - but identically named - keywords are created (which are also blank).

 

I am using the example code from OnBase API training I took in August 2018 as my primary reference.

 

It might be as simple as finding a more succinct example of setting Keywords on a new document that I can review,

but I cant help but think I am missing something important. Do I have to Save the document first, then fetch it back and set/store keywords? 

 

Any thoughts or pointers appreciated!

 

1 ACCEPTED ANSWER

Thilina_Random2
Star Contributor
Star Contributor

Make sure you are using a KeywordModifier and make sure to call the ApplyChanges() method on that when you are done.  Have a separate function to add a single keyword value to a document with all that code in it and call that function each time you need to add a keyword.

View answer in original post

2 REPLIES 2

Thilina_Random2
Star Contributor
Star Contributor

Make sure you are using a KeywordModifier and make sure to call the ApplyChanges() method on that when you are done.  Have a separate function to add a single keyword value to a document with all that code in it and call that function each time you need to add a keyword.

Re-organizing my code along these lines was enough to spot a KeywordType problem and get my workflow working.

Much thanks for the guidance Thilina!