Hi,
We have a workflow scenario to schedule the asset deletion using "READY FOR DELETION" in the Serial# field, but somehow it is not working, it is throwing error.
"
Executing workflow rules for execution group 'Deletions'...
2009/11/05 01:09:08.000 1 1 (0) Cannot delete record from table 'Assets (amAsset)' because it is referenced by at least one record from table 'Expense lines (amExpenseLine) (link 'Expense lines (ExpenseLines)').
2009/11/05 01:09:08.000 1 1 (0) Runtime error - Application defined or object defined error.
2009/11/05 01:09:08.000 1 1 (0) Runtime error at line 18 of Basic script ''Database action' of table 'Assets (amAsset)''
2009/11/05 01:09:08.000 1 1 (0) Error evaluating function ''Database action' of table 'Assets (amAsset)'' in script:\n'Error codes\r\nSetMaxInst(0)\r\n'Delete asset that has been flagged with SerialNo = 'READY FOR DELETION'\r\n Dim lRc as Long\r\n Dim hqWfInstance As Long\r\n Dim count as long\r\n\r\n count = 0\r\n\r\n' SETMAXINST (0)\r\n hqWfInstance = AmQueryCreate()\r\n lRc = AmQueryExec(hqWfInstance, \"SELECT lAstId FROM amAsset WHERE SerialNo = 'READY FOR DELETION' ORDER BY dtLastModif\")\r\n 'Delete record\r\n Dim hrWfInstance As Long\r\n\r\n Do While lRc = 0 AND count < 50\r\n hrWfInstance = AmGetRecordHandle(hqWfInstance)\r\n lRc = AmDeleteRecord(hrWfInstance)\r\n lRc = AmReleaseHandle(hrWfInstance)\r\n lRc = AmQueryNext(hqWfInstance)\r\n count = count + 1\r\n Loop\r\n\r\nIf count = 0 then\r\n Print \"No records to delete\"\r\nelse\r\n Print \"Deletion of \" & count & \" assets successful\"\r\nEnd if
2009/11/05 01:09:08.000 1 1 (0) Action 'Delete old assets' failed to execute
2009/11/05 01:09:08.000 1 1 (0) Unable to complete operation in current state.
"
Need your help to schedule mass assets deletion in assetcenter Ver 3.60 SP2- build 1807.
Regards,
Uma


Reply With Quote
Bookmarks