Posted: 24 Oct 2017 10:28 EDT Last activity: 25 Oct 2017 14:45 EDT
On Method Link-Objects
I am currently using the method Link-Objects to attach a file to my work object.
The problem is I need to retrieve later the Link-Attachment created by this method without retrieving it from the database as it is in the same transaction. I can't perform a commit after Link-Objects, it's called by an agent and commiting causes a variety of problems...
Could I find somewhere in the Clipboard the Page created to copy it somewhere just after calling Link-Objects ?
Can you say a bit more about why you need to retrieve it before the transaction is done?
If you ever need to query the db during a transaction without affecting the transaction, you can use RDBExecute, but you should really find a Pega-guardraily way to do what you need instead. However, if the thing you are looking for isn't yet in the db, then RDBExecute won't help.
If you believe the thing you are looking for has been obj-saved but not committed yet, it may be possible to catch it with a declare-trigger, the flavor that triggers on a non-committed save. But I'm not excited about doing this, since even if it works, there's no guarantee that a future version of the Pega software will continue to do such an obj-save.
Posted: 3 years ago
Posted: 25 Oct 2017 14:45 EDT
Mike Townsend (MikeTownsend_GCS)
Director, Software Solutions Engineering
I'm also having trouble following your usecase. You do a link-attach, but don't commit the transaction. So the objects in question are still on your clipboard somewhere, and you don't know where? Doesn't the LinkToPage property point to it for you? Can you make use of something like findPageByHandle() to find the page based on that? Perhaps it would be helpful to know more about what you need to find the page for. I would caution against copying it somewhere new so that there are two active copies in your clipboard. If you do that, you run the risk of changes on one copy stepping on changes to the other and resulting in data corruption. Best to manipulate the extant object and then save as appropriate. When the transaction is committed, the latest deferred save version will be written to the database.