Highlighted
Absent Member.
Absent Member.
2279 views

Persisting the requirement ID

Jump to solution

Hi all, using V11.52

 

I have a workflow script "Req_AfterPost" event to capture the newly created requirement ID. The requirement ID is captured correctly (a msgbox confirms this) however after assigning it to a user defined entity it subsequently goes back to zero. Here's the code:

 

Sub Req_AfterPost
  'On Error Resume Next
         Dim NewID
         NewID = "NEWID_" & Req_Fields.Field("RQ_REQ_ID").Value
         'msgbox NewID
         Req_Fields.Field("RQ_USER_01").Value = NewID
   'On Error GoTo 0
End Sub

 

The same code within the "Req_FieldChange" event works fine, I'm guessing because at this point the requirement ID has been committed to the database.

 

I'd love some insight into why the value is going back to zero when creating a new requirement and more importantly if there's any way around this.

 

Regards,

Bas

0 Likes
13 Replies
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Jan,

I tried the code in a new project with no modifications other than a requirement user field. below is the code from the requirements module. Even with this when I create a new requirement the user field is not populated. Do you have any other entries in the Common Script area? Can you possibly post the code you used tested. Thank you.

Sub Req_New
  On Error Resume Next

  On Error GoTo 0
End Sub

Sub Req_MoveTo
  On Error Resume Next

  On Error GoTo 0
End Sub

Function Req_FieldCanChange(FieldName, NewValue)
  On Error Resume Next

  Req_FieldCanChange = DefaultRes
  On Error GoTo 0
End Function

Sub Req_FieldChange(FieldName)
  On Error Resume Next

  On Error GoTo 0
End Sub

Function Req_CanPost
  On Error Resume Next

  Req_CanPost = DefaultRes
  On Error GoTo 0
End Function

Function Req_CanDelete(Entity)
  On Error Resume Next

  Req_CanDelete = DefaultRes
  On Error GoTo 0
End Function

Sub Req_AfterPost
  On Error Resume Next

     Dim newReq
     Set  newReq = TDConnection.ReqFactory.Item(Req_Fields.Field("RQ_REQ_ID").Value)
     msgbox Req_Fields.Field("RQ_TYPE_ID").Value&": "&newReq.ID
     newReq.Fields("RQ_USER_01") = Req_Fields.Field("RQ_TYPE_ID").Value&_
     Req_Fields.Field("RQ_REQ_ID").Value

     newReq.Post

     Set newReq = Nothing

  On Error GoTo 0
End Sub

Function Req_CanAddReqTraces(ReqId, TraceReqIds, Direction)
  On Error Resume Next

  Req_CanAddReqTraces = DefaultRes
  On Error GoTo 0
End Function

Function Req_CanDeleteReqTraces(ReqId, TraceReqIds, Direction)
  On Error Resume Next

  Req_CanDeleteReqTraces = DefaultRes
  On Error GoTo 0
End Function

 

 

0 Likes
Highlighted
New Member.

Hope this issue is resolved? As per my understanding the user not added the new field "RQ_USEr_12" in under

Customization> Requirement Types> Type of the requirement

Click on the user defined field and enable the check box

Hope this resolves to update the data in to this field

 

 

0 Likes
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.