Agent on WebQuerySave Event - Won't Run

got this message on the log:Unsupported trigger and search in the background or embedded agent

This is is in the WEBQUERYSAVE event:

@Command([ToolsRunMacro];“(ConsumerID)”)

This is the agent that runs

Sub Initialize

Dim agentLog As New NotesLog("Agent log")

Dim db As notesdatabase

Dim session As New notessession

Dim doc As Notesdocument



Dim doc1 As Notesdocument



Set db = session.CurrentDatabase

Set doc = session.DocumentContext

Call agentLog.OpenAgentLog

Call agentLog.LogAction("Processing:")





number = doc.ConsumerID_n(0)



If number = 0  Then

	

	viewname = "numbers"

	Set view = db.GetView(viewname)

	Set doc1 = view.GetFirstDocument

	

	

	nextnumber = doc1.SeqNum_n(0)

	Call doc.ReplaceItemValue("ConsumerID_n", nextnumber)

	Call agentLog.LogAction("Processing:"+nextnumber)

	newnumb = nextnumber + 1

	doc1.SeqNum_n = newnumb

	Call doc.Save(True,True)

	Call doc1.save(True,True)

	

	Call agentLog.Close

End If 

End Sub

Subject: Agent on WebQuerySave Event - Won’t Run

In the agent’s properties, try changing the target to “none”

Subject: RE: Agent on WebQuerySave Event - Won’t Run

That did it! I could kill myself! I wasted half a day doing this…

Subject: RE: Agent on WebQuerySave Event - Won’t Run

Several other triggers/search criteria would work too, I updated “Troubleshooting agents in R5 and ND6” agents with a complete list as well as the explanation of why you get that error message with ‘selected docs’. You will find a link to the article in Agent FAQ on the left under resources.