New Copy Trigger Feature in 7.3
Brian Laskey 270003US2W Visits (7527)
In my last
When you perform a typical Copy Object operation in the OpenPages UI (or via public APIs) it will actually copy over the selected objects and their children to a target parent. The selected objects are the 'source' objects, the target parent is the 'target', the resulting new objects copied under the target parent we'll refer to as the 'copies'.
Here is a simplified conceptual diagram of the moving pieces in a copy, where the left hand side would be an existing Source and it's related associations, when copied it creates new instances under the target, with the copy of the source itself is highlighted.
So as you see the new Copy might be interesting to get access to for a trigger developer that might want to do some post-processing on the resulting Copy of this operation.
Prior to 7.3, the GRC Trigger framework (and the SDK) did not provide any direct way to retrieve the actual Copy being made from within the trigger. This caused a lot of headache for developers, as it meant crafting ad-hoc ways to find the Copy as a child of the Target. For example from the CopyResourceEvent passed to your GRC Trigger's Event Handler class, you could use the getT
In 7.3 we have enhanced the CopyResourceEvent with a new method to reference the Copy. The new method signature is:
public Id getCopiedObjectId()
It is now possible to get the Resource Id for the Copy instance (but not directly to it's Copied children) in the POST phase for a Copy Objects operation. An example of what this code would look like is the following snippet which is for a use-case where you are updating the Copied object if it is of the Issue object type (SOXIssue):
public boolean hand
This example tries to check for the Copied objects id, and then retrieving the full IGRCObject instance so that the update to the OPSS-Iss:Status field can be performed. To configure this trigger you would need to update one of your trigger XML files, just as an example you might have a simple grcTrigger definition such as:
This is of course a very simple example, but it shows how you could use the new getCopiedObject method. I have placed full source code for this sample on github, you can find that here: http
I will leave it as an exercise to the reader to compile the class file and build a jar with it which you can deploy to the OpenPages 7.3 system. Refer to the Open