Agent to delete documents

I need to write an agent to delete documents older than 30 days that exist in a transaction view. What is the best way to go: simple action , formula lanquage or script? Is there any place to get sample code?

Subject: Agent to delete documents

The easy way is to create a simple action delete from database and add a search condition with an adjust of 1 month.Hope it helps.

Subject: Agent to delete documents

Sheryl

I think you could do it with a formula.

something like:

@If(Creation Date-whatever the current date function is>30; @Command([EditClear]); @Command([ViewRefresh]))

Could you let me know if this helps?

Marc

Subject: RE: Agent to delete documents

I wrote an agent which works if run manually. It is:SELECT View=Transmissions\Date;

timenow := @Now;

@If(@Date(QUEUEDATE) < @Date(@Adjust(timenow;0;0;-30;0;0;0));@DeleteDocument;OK)

Problem is I can’t get it to run if scheduled to run daily. No one here can figure out why.

If I can’t get this to work by tomorrow, I will have to start writing a Script agent.

Subject: Simple HOW-TO Steps

As you seem to be new to this, I’ll give you some step-by-step instructions.

Perform the following steps…

Go into the agents part of Designer (from any view in the database, choose VIEW, AGENTS).

Create a new agent called “CLEANUP”

Click into Document Selection and click the ADD SELECTION Button. Set the condition to BY DATE, and then change the drop-downs to say DATE CREATED then IS OLDER THAN and then type 30 (days) - Then click ADD.

Note that if you have multiple forms in your database, you may want to add a selection criteria to pick only the form types that you want deleted.

Click into the Action part, then choose ADD ACTION - In the Edit action box, select DELETE DOCUMENT FROM DATABASE and choose ADD.

Close out of the agent and save it.

Note that this will work if you put it into the database, but that you should really put it into the template and use the Administrator facility to sign it.

I hope this helps.

Gavin.