Pocessing a BO in AfterSave event


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Afte I save a BO, I need to do additional processing of the BO, updating some other tables and logging before and after data.

It would apear that the 'AfterSave' event is probably the best place to do this, but I cannot access rows marked for deletion.

I can copy the BO in the BeforeSave event (and then process it in the AfterSave Event) , but am having difficulty processing Deleted Records , as I cannot see them in the BO ( I have the OnlymarkAsDeleted option set when Deleting rows so they are not removed from the Database until I save) . Also when this flag is set, the AfterDeleteEvent still fires , even though the row will not have been physically removed from the Database table yet.

Any ideas appreciated
Replies
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Ivan.

I cannot see anyway within the BusinessObject to trap a Delete when I have the OnlyMarkAsDelted flag set . How do users capture Audit Type data where you would want to write away Deleted records to an Audit table ?

As there does not seem to be a way within the Business Object to do what I want to do, I have been looking at processing the raw dataTable behind the Business Object . This seems to have all the Rows in it , even deleted ones which will be marked as deleted. My thoughts are as follows:

1. On the BeforesaveEvent, Copy the CurrentDatatable to a 'BeforeSave' table
2. Let SF Save the BO as normal
3. In the AfterSave event, do some Post Processing on the 'Beforesave' table


 This seems like a lot of work, and if there is another way of doing this with Business Objects, maybe somebody could jump in. If anybody has inserted auditing type functionality, it looks like they would already have done this sort of thing.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
I cannot see anyway within the BusinessObject to trap a Delete when I have the OnlyMarkAsDelted flag set . How do users capture Audit Type data where you would want to write away Deleted records to an Audit table ?


What about using the BeforeDelete, throwing your own Delete Confirmation message, if Delete was confirmed, you would have the record standing right there for you to do whatever.
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Ivan

Even if I do this, because I have the OnlyMarkAsDeleted set, the record is deletd from the BO (but not from the Database Table yet), but the user can Undo changes, which means the Deleted record is Undeleted. Still back to the situation where I cant , or dont want to anyway, do anything until the Backend Database tables have been updated.

I suppose ideally what I am looking for is the Business Object  (or some version of  it ) just prior to the database Update which has both the New,Modified and deleted rows in it).

I would have thought that anybody who is logging Audit type stuff must have already done this ?
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Yeah, I haven't tried OnlyMarkAsDeleted on a maintenance form. I did it when programmatically deleting many records.

The way I would go would be, as I said, to use the BeforeDelete, get that record on a temp BO and deal with it AfterSave. In the case of an Undo, nothing would have to be done.

But I guess someone else who has approached this in a different maner might jump in and give you some other ideas.

Cheers.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ger Cannoll - 14 Years Ago
Ivan George Borges - 14 Years Ago
Ger Cannoll - 14 Years Ago
Ivan George Borges - 14 Years Ago
Ger Cannoll - 14 Years Ago
                         [quote]I cannot see anyway within the BusinessObject to trap a Delete...
Ivan George Borges - 14 Years Ago
                             Hi Ivan Even if I do this, because I have the OnlyMarkAsDeleted set,...
Ger Cannoll - 14 Years Ago
                                 Yeah, I haven't tried OnlyMarkAsDeleted on a maintenance form. I did...
Ivan George Borges - 14 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search