Error Message: ”Specified cast is not valid” after ALM 12.21 Patch 6 to Patch 7 Upgrade
Question ID: 109174

Hi ,

Received error message after clicking on create new test script button in test plan.
This issue started only after ALM 12.21 Patch 6 upgrade to Patch 7.
In the common script module, below is the code associated with TS_Version field.

Dim TS_Version
TS_Version = userfield("Version","TEST")

Function userfield(label,tablename)
sql = "Select SF_COLUMN_NAME as thecolumn FROM SYSTEM_FIELD WHERE SF_USER_LABEL="’ & label & "’ "
sql = sql & "AND SF_TABLE_NAME="’ & tablename & ""’

set req = requestRecordset(sql)
if req.Recordcount > 0 then
result = req.FieldValue("thecolumn")
msgbox "Error for the field " & label
end if

userfield = result
end Function

After this code is executed, string value "TS_USER_TEMPLATE_03" is stored in TS_Version variable.

For Version Labeled UDF , in ALM customization project entity’s list, type is NUMBER and length is 255. But when we describe TEST table and see the datatype for this same column in TEST table it is VARCHAR2(255). Not sure, why it got created as datatype varchar2(255) when it is declared as NUMBER in ALM , also not sure how code "Test_Fields(TS_Version).Value = 0" is working in Patch 6 and why it is failing in Patch 7.

In the Test_New module, we have below code:

Sub Template_Test_New
Test_Fields(TS_Version).Value = 0
End Sub

Error message is triggered at the line `Test_Fields(TS_Version).Value = 0`

Below is the screenshot of workflow error message:

![alt text][1]

Same line of code is executing from Visual Studio Debugger without any issues ,but from IE it is failing:

? Test_fields(TS_Version).Value = 0

Below is the clue i found but could not convert into a acceptable solution:

Looks like issue is definitely with "OTAClient.Core.dll" and might not be with the workflow script.
In patch 6 its size is 773 KB , where as in Patch 7 its size is 765 KB.As part of my trouble shooting steps, I replaced the problematic Patch 7 "OTAClient.Core.dll" with Patch 6 "OTAClient.Core.dll" in ALM userprofile location i.e. "C:\\Users\\<<>>\\AppData\\Local\\HP\\ALM-Client\\<<>>.Post that, issue did not occur in Patch 7, test script creation is not leading to "Specified Cast not valid" error message.

But, since it is not a acceptable solution, I could not rollout to user machines.

Could some one help on the below questions:

1. What is the cause of this issue, and how this issue can be fixed?

2. If there is no other option other than modifying workflow script, what is the change that has to be made in workflow?

Regards, Srihari

[1]: /storage/temp/964-ts-version-workflow-error-message.jpg

Marked as spam
Posted by (Questions: 33, Answers: 21)
Asked on August 31, 2019 5:19 pm
Answers (1)
Private answer

In the workflow script, If I modify below line

Test_Fields(TS_Version).Value = 0
Test_Fields(TS_Version).Value = cstr(0) , then it is working fine in patch 7 without errors,

But, In patch 6 why is it working without changing 0 to cstr(0) ?

Also, in few sections we have code to increment Version value , something like below:

If Test_Fields(TS_Version).Value <> '''' then
Test_Fields(TS_Version).Value = Test_Fields(TS_Version).Value + 1
Test_Fields(TS_Version).Value = 1
End If

Should it be changed like below, will there be any impact in doing so? when we upgrade to future ALM versions or patches will there be a breakage in workflow code?

If Test_Fields(TS_Version).Value <> ''''
Test_Fields(TS_Version).Value = cstr ( cint(Test_Fields(TS_Version).Value) + 1)
Test_Fields(TS_Version).Value = cstr(1)
End If

Strange thing is, in other modules like REQ , we have same code in REQ_New

Req_Fields(RQ_Version).Value = 0

RQ_Version is RQ_USER_TEMPLATE_03 defined as NUMBER , length 255 in ALM entities customization, in Oracle REQ table datatype is created as VARCHAR2(255).

I am not understanding why code is working fine in REQ module while creating new requirement and why it is failing when creating new test script in test plan, both are using same concept.

Please advise.


Marked as spam
Posted by (Questions: 33, Answers: 21)
Answered on September 5, 2019 7:20 pm

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

Scroll to Top