In Vbscript how do I change a choose from list to an Integer?

I have a property of type date, and a property of type Choose from list where the list is a value list of numbers (30, 60, 90, etc.).  I need a new calculated date property that takes the original date property (if entered) and subtracts the number of days selected from the value list.  So if the date property is 5/31/2025 and the Choose from list property is 2, the resulting calculated date property is 5/29/2025.

I'm using Vbscript to try to calculate this. Yesterday instead of using a Choose from list for 30, 60, 90, etc. I just had a property of type Integer and my script worked.  But now the users want to force people to choose from a list of numbers instead of just entering one.

I can't get my revised vbscript to work.  

Here's the script: ------------------------------------------------------------------------------------------------

'Deadline to react
Option Explicit

Const propContractRenewalDate = 1308
Const propAddlDaysLeadTime = 1333

Dim PropertyValues : Set PropertyValues = Vault.ObjectPropertyOperations.GetProperties( ObjVer )

Dim CRenewDate
Dim AddlDays
Dim CustomReminderDate
Dim NumAddlDays

CRenewDate = PropertyValues.SearchForProperty( propContractRenewalDate ).Value.Value
AddlDays = (PropertyValues.SearchForProperty( propAddlDaysLeadTime ).Value.Value)

if (len(AddlDays & "") = 0) then
NumAddlDays=0
else
NumAddlDays=Cint(AddlDays)
end if

if ((NumAddlDays=0) or (IsNull(CRenewDate))) Then
CustomReminderDate = ""
else
CustomReminderDate = DateAdd("d", -NumAddlDays, CRenewDate)

End If

Output = CustomReminderDate

---------------------------------------------------------

I think it fails at the point I try to get the integer value of the Choose from list value --- Cint(AddlDays)

The error message is Type mismatch

<MetadataEditor>, -, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
ScriptErrorHelper.cpp, 96, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MDispatchExImpl.h, 679, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MDispatchExImpl.h, 841, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MetadataCardAction.cpp, 386, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MetadataCardAction.cpp, 560, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MetadataEditor.cpp, 2972, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MetadataModel.cpp, 4538, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MetadataModel.cpp, 4983, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
ElectronicSignatureUIHelper.cpp, 239, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MetadataModel.cpp, 12758, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
CoVaultMountingDocumentOperations.cpp, 3335, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
CoVaultMountingDocumentOperations.cpp, 3423, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
DocumentCache.cpp, 12019, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
DocumentCache.cpp, 12130, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
DocumentCache.cpp, 20514, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
IRPCObjectOperations.generated.cpp, 18366, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
gRPCClient.cpp, 497, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
gRPCClient.cpp, 466, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
gRPCClient.cpp, 99, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
gRPC.generated.cpp, 19820, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
RPCDocumentOperations.cpp, 7428, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
MCallInLoop.h, 535, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
RPCDocumentOperationsHelper.cpp, 4270, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
RPCDocumentOperationsHelper.cpp, 3717, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
RPCDocumentOperationsHelperPrivate.cpp, 8086, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
RPCDocumentOperationsHelperPrivate.cpp, 7881, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
RecalculateProperties.cpp, 449, Calculation of the automatic value of the property "Additional Reminder Date" failed. (0x80040107)
RecalculateProperties.cpp, 449, Script execution failed. ((Additional Reminder Date, PropertyDefCalculatedValue: 196-18)) (0x800408BB)
RecalculateProperties.cpp, 1765, Script execution failed. ((Additional Reminder Date, PropertyDefCalculatedValue: 196-18)) (0x800408BB)
RecalculateProperties.cpp, 1582, Script execution failed. ((Additional Reminder Date, PropertyDefCalculatedValue: 196-18)) (0x800408BB)
RecalculateProperties.cpp, 1832, Script execution failed. ((Additional Reminder Date, PropertyDefCalculatedValue: 196-18)) (0x800408BB)
RecalculateProperties.cpp, 1522, Script execution failed. ((Additional Reminder Date, PropertyDefCalculatedValue: 196-18)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 283, Script execution failed. ((Additional Reminder Date, PropertyDefCalculatedValue: 196-18)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 388, Script execution failed. ((Additional Reminder Date, PropertyDefCalculatedValue: 196-18)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 388, Type mismatch (0x80040008)
VaultScriptSessionTemplates.cpp, 667, Type mismatch (0x80040008)
CoActiveScriptSite.cpp, 915, Type mismatch (0x80040008)
CoActiveScriptSite.cpp, 745, Type mismatch (0x80040008)
Additional Reminder Date, PropertyDefCalculatedValue, 17, Type mismatch (0x80040008)
MErrorHelper.cpp, 2436, Type mismatch (0x80040008)
(M-Files 25.5.14829.4 2025-05-30T15:18:39.674Z)

Parents Reply Children
No Data