cancel
Showing results for 
Search instead for 
Did you mean: 

Required Keywords and default value is null

Smitha_Challa
Star Contributor
Star Contributor

Hello, 

We are using On base 15. We are trying to get the default value of a required keyword.

Screenshot 1: On base config:  I have Name as a required Keyword and set the default value = 'HELLO WORLD'

Screenshot 2: On base client, Name is shown in red. This is correct. Although it shows no Default value. 

I am seeing the same behavior in code.

DocumentType docType = app.Core.DocumentTypes.Find(123); 

KeywordType kwType = docType.KeywordRecordTypes.FindKeywordType("Name");

string default = kwType.DefaultValue. 

How do I get on base 15 to recognize the default value?

Thank you

1 ACCEPTED ANSWER

Timothy_Cosgrif
Star Collaborator
Star Collaborator

To get the default value, you're going to need to call CreateKeywordWithDefaultValue off of KeywordType and pass in the Document Type reference.

There was a problem with the original implementation of KeywordType.DefaultValue since default values are configured at a Document Type level.

View answer in original post

4 REPLIES 4

Timothy_Cosgrif
Star Collaborator
Star Collaborator

To get the default value, you're going to need to call CreateKeywordWithDefaultValue off of KeywordType and pass in the Document Type reference.

There was a problem with the original implementation of KeywordType.DefaultValue since default values are configured at a Document Type level.

This is a seperate topic:

Sometimes when I login using Manager who has full access, the document still opens even if the default value is not found.

What are the privileges to turn off so that a document with Required keyword and No default value will not open?

Patrick_Sweeney
Star Contributor
Star Contributor
Hello Smitha,

The required keyword setting actually does not restrict opening the document if the required keyword hasn't been specified. The REQN setting restricts a user from uploading a document with a blank required keyword (which is a restriction that can be circumvented by using the Unity API to upload the document). The REQR setting restricts the way the Document Retrieval Dialog works. I.e., if a Document type is configured with the REQR setting then the Document Retrieval Dialog will require the user to specify some value for any REQR keyword configured for the selected Document Type. In that way you won't be able to search for any documents with a blank REQR keyword.

There are caveats though. As I mentioned the REQR setting only restricts searching for the document via the Document Retrieval Dialog, it does not restrict opening the document other ways, such as by Document Handle. Furthermore if the user has the Product Right "Override Query Restrictions" they can ignore the REQR setting when using the Document Retrieval Dialog. Lastly if the Document Type Group has Group Search enabled then a user could return all documents configured for that Document Type Group, regardless of required keyword settings.

In other words it's possible to restrict the ways a user can access a document configured with a required keyword but it may take some doing.

Smitha_Challa
Star Contributor
Star Contributor
Thank you. I went and checked with the user. They are using REQN not REQN. So REQN and default value. You had mentioned that The REQN setting restricts a user from uploading a document with a blank required keyword (which is a restriction that can be circumvented by using the Unity API to upload the document). This is the behavior we are seeing. Thank you. I will continue the rest in the other question 🙂