cancel
Showing results for 
Search instead for 
Did you mean: 

Access Auto-Number keyword functionality from C# Scheduler script

Steve_Williams1
Star Contributor
Star Contributor

Hi,

 

I am writing a Unity Scheduler script in C#. I am trying to use a numeric keyword that is configured as an "Auto Numbered Key".

 

I cannot figure out how to access this functionality. sdk.onbase.com does not seem to have any references that I can find, nor does the intellisense when I am using the "KeywordType.CreateKeyword"... the CreateBlankKeyword doesn't return a value (blank, as expected). The CreateKeywordWithDefaultValue doesn't seem appropriate as it requires a DocType paramamter.

 

Is there any way to access the functionality provided by an auto number keyword through the Unity API?

 

I am using the C# code to (ultimately) create a Unity form. I am trying to define a "Batch" of unity forms that are created by the Unity script. So I do not want to put the batch number keyword on the Unity Form or it will (possibly) auto-increment for each form created, which is not what I want.

 

I want to fetch Auto-Number "Batch Number" keyword once, create a string (Batch Name) with the batch number (eg: "BATCH 1") and put the Batch Name keyword on each unity form.

 

I'm trying to avoid creating a new document type with a single document to store the continually incrementing Batch Number.

 

Thanks,
Steve Williams

1 ACCEPTED ANSWER

Steve_Williams1
Star Contributor
Star Contributor

Followup from API Support via our FLOS

 

It actually is possible to assign an auto number keyword through the API, though the process isn't exactly intuitive. CreateKeywordWithDefaultValue is the correct method to use, but it needs to be used in conjunction with the StoreNewUnityFormProperties object's ExpandKeysets property set to true. With both of these items, Unity Forms and E-Forms can have their auto number keywords populated with an incrementing value.

It doesn't seem that this alone would satisfy the requirement described though. I think they would still need to create a dummy document type with this keyword, then retrieve that value from the newly created document to be applied to all unity forms in the batch, and finally delete the dummy document.

View answer in original post

3 REPLIES 3

AdamShaneHyland
Employee
Employee

Hi @Steve Williams ,

 

I don't believe there is any Auto Number Keyword functionality within the Unity API as you noticed since there is no documentation from the SDK.  However, if you were to create the Unity Form with a Keyword Type configured as an Auto Number Keyword Type, the Keyword Type configured as an Auto Number Keyword Type should increment accordingly.  Unfortunately this will not address your issue since as you noted this value would then increase with the submission of each new form.

 

The idea of using a separate Document Type to store a Document used as the primer for the Auto Number Keyword value would work.  While it is not ideal, it would provide the functionality you are looking for.  The caveat here is would be what is triggering the Auto Number Keyword value to increment?  You would have to have a new Document storing storing the incremental value so you could capture it. 

 

One way to do this would be through the use of a Virtual E-Form.  You could create the Virtual E-Form, capture the Auto Number Keyword value into a Property Bag property and then delete the Virtual E-Form.  This way you always have the current Auto Number Keyword value.

 

Best wishes.

celsocastillo
Employee
Employee

Hello Steve

 

As a way to perform auto numbering, you want to create a new document type like "XXX - Internal Sequences" with 2 keywords description and any other using numeric data type.

 

In your code just retrieve a that document base on "Description" keyword (So you can have multiple sequences) grab current number, increment and saved retrieved document.

 

Hope this idea works in your case

 

Regards

 

Steve_Williams1
Star Contributor
Star Contributor

Followup from API Support via our FLOS

 

It actually is possible to assign an auto number keyword through the API, though the process isn't exactly intuitive. CreateKeywordWithDefaultValue is the correct method to use, but it needs to be used in conjunction with the StoreNewUnityFormProperties object's ExpandKeysets property set to true. With both of these items, Unity Forms and E-Forms can have their auto number keywords populated with an incrementing value.

It doesn't seem that this alone would satisfy the requirement described though. I think they would still need to create a dummy document type with this keyword, then retrieve that value from the newly created document to be applied to all unity forms in the batch, and finally delete the dummy document.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.