I am new to trying to write agents on my own and I stumped how to combine two simple formula functions for an agent.
All I want to do is prompt a user to have a gien field value replaced with the entered value.
For example, after selecting documents to be modified, run the agent and be prompted for “New Territory Name” and after keying the value, having it replace whatever the exisiting value is in the field called “IENRegion”
I know this should be extremely elementary and I’m not sure why I’m not able to figure it out myself. Thank you in advance for any help you may provide.
This is what I have so far:
ret :=@Prompt([OkCancelEdit];Territory;“Enter Territory Name”;Richmond);
@Replace($IENUserKey04Value;“”;ret);
SELECT @All
Where “IENUserKey04Value” is the data field I want to replace with a new value on all documents I’m running the agent against.
The code looks OK bar the fact that you will get this prompt for every document you’ve selected. Is that what you mean by posting that the code isn’t working properly? Personally I would implement this in script. Ask the user for their input once up-front, then apply the change to NotesDatabase.UnprocessedDocuments (i.e. the selection). Doint his in @formula is tricker: you probably need two agents. One to take the user input and write it to the INI file, calling the second agent. The second agent then picks up the value from the INI file and writes it to the document selection.
Either I do not know how to implement this or it has a bug in it. It also requires input on every single record and then also fails to change anything.