Highlighted
TracyH Absent Member.
Absent Member.
540 views

Cut and Paste of Requirements retains wrong review Status....

Jump to solution

I have a need to set the Review Status of a Requirement to "New" when a new requirement is pasted from an existing one.

Currently the status is always set to the same as the requirement you are copying from.

 

What I thought of doing was this:

1) In ActionCanExecute in Common Script I am testing for Requirements.Paste.

2) If it is found then I set a global variable (CopyReq) to "Yes"

3) In the Requirements module in the Sub Req_MoveTo I added a line testing for the value of the variable and if it = "Yes" then I set the Status and reset the variable:

     If CopyReq = "Yes" then
         Req_Fields.Field("RQ_REQ_REVIEWED").Value = "New"
         CopyReq = "No"
     end if

 

This works ok sort of, but I now have 2 history entries of changing the Status when I really just wanted it to be created as New. I am concerned this will ask the question of why did x change the state?

 

Any ideas?

0 Likes
1 Solution

Accepted Solutions
Absent Member.. Trudy Claspill Absent Member..
Absent Member..

Re: Cut and Paste of Requirements retains wrong review Status....

Jump to solution

Instead of allowing the Paste to proceed, you could abort the action. Then, instead, use a custom function to execute API commands to create a new requirement based on the data from the original requirement. You would need to capture the ID of the original requirement, so that you could use API commands to retrieve it. And you would have to capture the location the new requirement would've been pasted to, so that you can tell the API to create it there.

 

I don't know for sure that this would work. I haven't tried to implement this solution, and I'm not going to spend my time trying it.  There are too many other factors to consider. For example, does the source requirement have any attachments that need to be copied, or children that need to be copied, or links to tests?

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
4 Replies
Absent Member.. Trudy Claspill Absent Member..
Absent Member..

Re: Cut and Paste of Requirements retains wrong review Status....

Jump to solution

Instead of allowing the Paste to proceed, you could abort the action. Then, instead, use a custom function to execute API commands to create a new requirement based on the data from the original requirement. You would need to capture the ID of the original requirement, so that you could use API commands to retrieve it. And you would have to capture the location the new requirement would've been pasted to, so that you can tell the API to create it there.

 

I don't know for sure that this would work. I haven't tried to implement this solution, and I'm not going to spend my time trying it.  There are too many other factors to consider. For example, does the source requirement have any attachments that need to be copied, or children that need to be copied, or links to tests?

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
TracyH Absent Member.
Absent Member.

Re: Cut and Paste of Requirements retains wrong review Status....

Jump to solution

Thanks for the direction Trudy. As always you gave me enough help to get me on the right road 🙂

 

I took you advise and effectively disable the paste action for Requirements and this prevents an erronous requirement from slipping into the show.

0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Cut and Paste of Requirements retains wrong review Status....

Jump to solution

The extra history entry is the smallest of your problems. Your code will only work if a user is pasting a single requirement. You need to consider the case where there are an unknown number of sublevels to a pasted requirement.

 

What you could do to handle that is to prevent the default Paste action from executing, then let it execute explicitly followed by an iteration over all sublevels where you set the status to New. Can be done, but it will take some more coding. And you would still have the double history entries.

 

Someone might suggest you use a Command object SQL update of all items below the root item using the RQ_REQ_PATH value, which will tell where the reqúirement is localized in the tree structure. That would be a lot easier to code and it probably won't create any history record. But personally I would avoid that - too risky in my opinion.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Cut and Paste of Requirements retains wrong review Status....

Jump to solution

I didn't see your last update until now. Preventing the paste action will of course solve your problem if that is an acceptable solution.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
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.