Web Agent Unable to Get Field Values

I have an agent that works when called using @command([toolsrunmarco]). But I since I need to add the prompt function of javascript, which primary use is to get comment from user before clicking process button (sending and changins of doc status) I instead run it on Web Common JavaScript with

location.href=“http://Host/Database/AgentName?OpenAgent”

The “Agent Done” is displayed but the agent does not work at all. I tried displaying the field value of some fields in the server console but it gets no value.

Can someone please tell me where I went wrong?

Also, since formula languange is working. I am also trying to call the javascript prompt function from the formula language.

Any idea if this works?

Would appreciate to get solution on this. Thanks so much!