Knowledge Partner
Knowledge Partner

Error Message: "Specified cast is not valid" after ALM 12.21 Patch 6 to Patch 7 Upgrade

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:

TS_Version Workflow Error message.jpg

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, could not perform this workaround on all the 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

3 Replies
Knowledge Partner
Knowledge Partner

Re: Error Message: "Specified cast is not valid" after ALM 12.21 Patch 6 to Patch 7 Upgrad

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?



 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.


Knowledge Partner
Knowledge Partner

Re: Error Message: "Specified cast is not valid" after ALM 12.21 Patch 6 to Patch 7 Upgrad


Could someone please help me with investigation of this issue.


Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Error Message: "Specified cast is not valid" after ALM 12.21 Patch 6 to Patch 7 Upgrad

I think sometimes you just have to accept that ALM is behaving illogically. I have noticed a similar behavior that in the OTA you sometimes have to explicitly cast a value to String before you can use it. And I never found a pattern to it.


Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.