Agent called; "Doc not yet saved" error

I am calling an agent from a view action via the following code:

@SetProfileField(“EnvironmentVariables”; “FormName”; “Contact”; @UserName);

@PostedCommand([ToolsRunMacro]; “lsCreateNewBasedOnCurrent”)

This works fine. However, when I use the same code from a hotspot on a page, I get the “Document has not yet been saved” error. When I click ‘OK’ in the error dialog box, the code runs as it should, so I suspect the error is occurring before the code even runs but I can’t figure out why. I’ve been trolling around this forum for a couple of hours now. I’m sure it’s simple…Thanks in advance.

Subject: Agent called; “Doc not yet saved” error

I think this is the result of having your agent properties set to run on selected documents. If you choose “None”, I believe it will solve it.

Subject: RE: Agent called; “Doc not yet saved” error

That worked for me too!Changed to none, and it works.

Subject: RE: Agent called; “Doc not yet saved” error

Thank you, Cesar, that did the trick!