@AddToFolder with agent

I’m trying to move incoming e-mails to folders using agent and not getting lucky with the @AddToFolder.

To give you a little background…

We have mail-in db where analysts recieve trouble tickets from the help desk database. We’ve an agent in that notify analysts when new tickets arrive in the database. The analysts are notified in orderly manner; 1st ticket to Analyst_1 , 2nd ticket to Analyst_2 and so on. When the last analyst gets his ticket, the order starts over again. All these are working fine except that the when the agent runs the incoming e-mails are not moved into the Analysts folders. Is there anything I’m missing in the below code?

SequentialNumber := @Subset(@DbColumn(“” : “NoCache”;“”:“”; “LastNumber”; 1);1);

Incremented:=@If(SequentialNumber = -999; 0; !@IsNumber(SequentialNumber); 1; SequentialNumber + 1);

Count :=@Modulo(incremented;6)+1;@If(@IsError(tmp);0;tmp);

FIELD Incremented:=Incremented;

FIELD Count:=Count;

FIELD AgentFlag := “Y”;

message := “RE: New Ticket has been assigned to you. Please double click on the doclink to view the request.”;

@If(Count = 1; @MailSend(“Analyst_1”; “”; “”; “Ticket 1:”; message; “”; [IncludeDoclink]); “”);

@If(Count = 2; @MailSend(" Analyst_2"; “”; “”; “Ticket2: ticket”; message; “”; [IncludeDoclink]); “”);

@If(Count = 3; @MailSend(“Analyst_3”; “”; “”; “Ticket3: ticket”; message; “”; [IncludeDoclink]); “”);

@If(Count = 4; @MailSend(“Analyst_4”; “”; “”; “Ticket4: ticket”; message; “”; [IncludeDoclink]); “”);

@If(Count = 5; @MailSend(“Analyst_5”; “”; “”; “Ticket5: ticket”; message; “”; [IncludeDoclink]); “”);

@If(Count = 6; @MailSend(“Analyst_6”; “”; “”; “Ticket6: ticket”; message; “”; [IncludeDoclink]); “”);

@If(Count = 1; @AddToFolder(“1. Analyst_1”; “($Inbox)”); “”);

@If(Count = 2; @AddToFolder(“2. Analyst_2”; “($Inbox)”); “”);

@If(Count = 3; @AddToFolder(“3. Analyst_3”; “($Inbox)”); “”);

@If(Count = 4; @AddToFolder(“4. Analyst_4”; “($Inbox)”); “”);

@If(Count = 5; @AddToFolder(“5. Analyst_5”; “($Inbox)”); “”);

@If(Count = 6; @AddToFolder(“6. Analyst_6”; “($Inbox)”); “”);

Thanks in Advance!

Subject: @AddToFolder with agent

what is the agent trigger?

Subject: RE: @AddToFolder with agent

The agent is set up to runs “After New Mail Arrives”.

Thanks for your help!

Subject: RE: @AddToFolder with agent

you need to combine your actions. what’s happening is that your IF statement is satisfied for the mailsend action so it exits at that point and never gets to the second batch of IF statements. So what you need to do is move your AddToFolder actions up where your MailSend actions are so that they both occur at that time. Also, since all of your actions are based on the Count you could simplify your code with something like this:

SequentialNumber := @Subset(@DbColumn(“” : “NoCache”;“”:“”; “LastNumber”; 1);1);

Incremented:=@If(SequentialNumber = -999; 0; !@IsNumber(SequentialNumber); 1; SequentialNumber + 1);

Count :=@Modulo(incremented;6)+1;@If(@IsError(tmp);0;tmp);

FIELD Incremented:=Incremented;

FIELD Count:=Count;

FIELD AgentFlag := “Y”;

analyst := “Analyst_” + @Text(Count);

ticket := "Ticket " + @Text(Count);

message := “RE: New Ticket has been assigned to you. Please double click on the doclink to view the request.”;

@MailSend(analyst; “”; “”; ticket; message; “”; [IncludeDoclink]);

folder := @Text(Count) + ". " + analyst;

@AddToFolder(folder; “($Inbox)”)

Subject: RE: @AddToFolder with agent

Thanks Paul!

But, where & how would I define the analyst & folders names in the agent?

Subject: RE: @AddToFolder with agent

I did it for you already, try the code I gave you in your agent and see if it works.

Subject: RE: @AddToFolder with agent

Thanks, Paul! The agent is working Great! Now, the users want me to create folders using their real names and forwarded assigned tickets to their folers. Instead of Analyst_1 or Analyst_2, the folder will have “Joe Doe” and “Jane Doe”. How would i modifiy the agent to do this?I have six names for now…

I appreciate your patience and unweavering support!