• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 428
  • Last Modified:

Agent to Pull managers name from Names.nsf

I have a view - in this view the first column is UserId (shortnames)  Inside each document there is a field call testmgr.  I am wanting to use the UserId to get the managers name and place it in the field.  I have the code and it works as a action inside the form, but when I try to run it as a agent on all documents in view it fails.  Here is my agent

SELECT Form = "User Information";
lookup := @DbLookup("":"NoCache";"Server/Server":"names.nsf"; "($Users)";UserId; "Manager");
@SetField("testmgr"; lookup);

I think the problem is the agent is not getting the UserId from the undelying documents?
0
Jaziar
Asked:
Jaziar
  • 3
  • 2
1 Solution
 
qwaleteeCommented:
Try this, and let me know what appears in the TEST_RESULT field:

SELECT Form = "User Information";
lookup := @DbLookup("":"NoCache";"Server/Server":"names.nsf"; "($Users)";UserId; "Manager");
@SetField("testmgr"; lookup);
FIELD TEST_RESULT := "UserID='" + UserID + "'; lookup result='" + @Text(lookup) + "'"


If there is no field TEST_RESULT after running the agent, then the agent did not even attempt to process the document.  Either you have a bad SELECT statement, or the document did not qualify for agent procesisng (e.g., it was not selected or was in the wrong view or whatever criteria you set up when designing the agent).

If TEST_RESULT did appear, what was in it?  Was there a value for UserId?  Was there a value for lookup result?  Was it an error value?
0
 
JaziarAuthor Commented:
It did not try to create a field TEST_RESULT.  I do know that all the documents in the view were created from the form User Information.

When I run the agent it gives me a status bar as it runs through the documents, then after it has finished it selects all the documents with a check mark, but nothing in the document as changed
0
 
JaziarAuthor Commented:
I can take the code put it in a action button in the form and it works great.  Why is the agent not getting the values from the form?  Any Ideas
0
 
JaziarAuthor Commented:
It does work - thanks
0
 
qwaleteeCommented:
Oh, this is so simple!  There are three ways an agent can run:
1) Modify document
2) Create copy of document and modify the copy
3) Don't modify document, just select it if it matches

You switched from 1 (the norm) to 3!  Bottom right of agent design screen.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now