Connect-It Delete Script with Asset Manager
I am trying to create a Connect-It script to delete asset records that we no longer want to track in Asset Manager. Some of these asset records have multiple Expense lines linked to them, which is where I am running into trouble. I created the script so that our asset management group can provide us a list of asset tags from Asset Manager into a separated text file. Then I have two mappings, the first is on expense lines, it reconciles on asset tag (Asset.AssetTag) and I prequery the expense line table to generate a variable populated with the lExpLineId from that asset tag (the first one it comes across, I guess) and then I do a RetVal = lExpLineId, and the reconciliation type is set to Delete. This works great for all of the asset records that have one expense line. But not more than one, I tried some looping queries, but apparently it can only produce one document per mapping.
The second mapping deletes the assets (after the expense lines are gone from the first mapping) reconciling on asset tag as well.
My questions is, if there is more than one expense line, is there a way to delete all of them without running the script more than once? I am using Asset Manager 5.22 build 8690 with Connect-It 9.50 (and we have an Oracle 11g back-end.)
Did you try through collection reconciliation (Delete)?
Start with the amAsset table and based on the query against Expenselines table get all the expense ids.
With those ids set the collections (amExpenseLines) with the reconciliation option as Delete.
This should do what you need I believe.
My first question would be: Why delete Asset data? Generally it should be retained for 7 years in any organistaion for legal purposes. I would choose the archive option instead. Let's assume that these records are older: then why would you first export this data from AM, and use a CIT scenario to delete this data?
If it is done for performance reasons there are also other opportunities for batch processing; not inteacting with the client(s).
If the initial selection is done (e.g. status 'marked for deletion/archive') : make an update and have a workflow delete/archive them.
The issue for the extended deletions: can be an issue: Either set the option to hanlde this, or make a script that handles it. I rest the case: archiveing is better than deleting.
So then start at the amAsset table (Reconciliation type set to update; reconciling on AssetTag still) and then link to ExpenseLines, and then create a loop query to provide all lExpLineId's derived from the asset record I am reconciling on? (With the Reconciliation type on ExpenseLines set to Delete?) Or do I need to "Activate collection reconciliation" under the "Advanced reconciliation" tab?
I dont think you need to "Activate Collection Reconciliation". Just setting the reconciliation type to Delete on expenseLines collection would do. Please test it your test environment....
Thanks for your replies. It does not seem to be working for me, I cannot get it to see (or delete) more than one expense line on any given asset record. I am currently trying 3 separate scripts that are just direct mappings hoping that without a bunch of queries that they will run faster. The first script will remove any children on the portfolio table of the assets I want to delete, the second will delete the expense lines of those assets, and the third will delete the assets themselves. Hopefully it will be faster, since I now have to pull 3 separate exports from AM for each of the 3 files.
We were originally told by a consultant firm when we were first setting up Asset Manager (AssetCenter at the time) that we should create assets for everything, and we could get rid of asset records later if we decided there was no value in keeping them. Well now we have thousands upon thousands of asset records for hard drives, floppy drives, network cards, and other miscellaneous component-type asset records that don't have serial numbers or DNS names, or any other way to track them. And there isn't anyone looking at them or updating them, so they provide no value for Asset Tracking. We did not realize how long it would take to delete them using the Asset Manager client, or even a Connect-IT script.
Reading this, and having had such an issue in the past, the following will work but wil ltake its time:
Go in the options (Edit>Options) and activate Extended Deletions (under section Edit).
Then in the Client Select the Portfolio Items (or Assets if you want) and click delete.
You will be prompted for all the referenced links to the tables and gives you the option to reallocate, drop the link (set l..Id to 0), or delete the links.
This will freeze te client for a while but will get the job done.