Agent Code

I am trying to get some data from a selected document and place it another document for easier build. I want to do this in an agent, but it is saying “@Command and other UI functions are not allowed with this search type; please select ‘None’ as your runtime target”; however when I run it in an action button it works fine. Here is the code.

temphost := @GetDocField(@DocumentUniqueID; “hihostname”);

tempserial := @GetDocField(@DocumentUniqueID; “hiserial”);

tempmodel := @GetDocField(@DocumentUniqueID; “himodel”);

tempip := @GetDocField(@DocumentUniqueID; “hiaddress”);

tempmachine := temphost + " " + tempserial + " " + tempmodel + " " + tempip;

@Command([Compose];“Create Topology Instance”);

FIELD Selected := “1”;

FIELD title := “Assign Hardware Instance to Solution”;

FIELD top_machine := tempmachine;

Any suggestions?

Subject: Agent Code

It is exactly as the messagebox said: the only valid target for agents that use @Commands is “None”. You can’t use them in scheduled agents or in manual agents set to run against a document collection (All documents in database, all documents in view, all selected documents). If the action works, then use an action – but have you tried this with multiple documents selected? If you can picture it happening with a few thousand docs selected, you might be able to appreciate why documnt collections are not allowed as a target.