Agent to run on selected documents

I’d like to create an agent that will only run on the documents selected by a user in a view.

IE. I have a timesheet database, with a supervisor view, the supervisor would like to be a able to check or select specifice documents that he would like to process, then run the agent to apply a field change: “status” from pending to approved. The agent I’ve created wants to run on all documents. How do I only process those selected by the user? When I save the agent it automatically appends SELECT @All - I remove it - save it and it’s there again:

MY Agent:

FIELD Approval1:=Approval1;

FIELD Approval2:=Approval2;

FIELD Approval3:=Approval3;

FIELD Payroll:=Approval4;

approve := 1;

@If(approve = 1 & @Name([CN];@UserName) = supervisor1; @SetField(“Approval1”;“Approved”);

@If(approve = 1 & @Name([CN];@UserName) = supervisor2; @SetField(“Approval2”;“Approved”);

@If(approve = 1 & @Name([CN];@UserName) = supervisor3; @SetField(“Approval3”;“Approved”);

@If(approve = 1 & @Name([CN];@UserName) = payroll; @SetField(“Approval4”;“Approved”);“”))));

Thanks for your help!

Christine

Subject: agent to run on selected documents

I think you don’t need to worry about SELECT @ ALL

In Agent properties set the target as “All selected documents”

The agent will run on only selected documetns.

AJ

Subject: RE: agent to run on selected documents

That was easy enough! Although what I fnd is - when you first open the view the default document may not be a document the approver may want to approve - they select all of the documents they want to approve, and although that default doc is not checked, it also gets approved along with the checked docs. Is there a way to disable the default on open option?

Thanks for your help!

Christine

Subject: RE: agent to run on selected documents

I am sorry. I am not clear with default doc. What do you mean by Default doc ??

Subject: RE: agent to run on selected documents

When opening a view - in view properties - you can set default doc to open to according to - the last doc opened - or top row - or bottom row - and then the row in the view is then highlighted by a black box around it.Christine

Subject: RE: agent to run on selected documents

Yes I got your point. But as soon as I opened the view I selected some other document (But still the black box was there with some other document) and when I run the agent it ran on the documents which I have selected and it did not run on default document. I am wondering how its running on all the documents in your case.

Subject: RE: agent to run on selected documents

Hmm…let me try it again…this is my code in my agent…I really appreciate your help with this!

FIELD Approval1:=Approval1;

FIELD Approval2:=Approval2;

FIELD Approval3:=Approval3;

FIELD Payroll:=Approval4;

approve := 1;

@If(@Name([CN];@UserName) = @Name([CN];supervisor1); @SetField(“Approval1”;“Approved”);“”);

@If(@Name([CN];@UserName) = @Name([CN];supervisor2); @SetField(“Approval2”;“Approved”);“”);

@Name([CN];@UserName) = supervisor3; @SetField(“Approval3”;“Approved”);

@Name([CN];@UserName) = payroll; @SetField(“Approval4”;“Approved”);“”;

SELECT @All

Subject: RE: agent to run on selected documents

It seems to be working…

Thanks for your help again & have a great day!

Christine