I have a general question. I have an agent written in formula language that generates the number of business hours that have passed for each document. There are a few modifications made to the fields and a few emails that are sent off if the hours reach a certain amount.
My problem is that this will be a scheduled agent that will need to run on all documents in the database. These field changes will not save unless I use the @Command[FileSave] command. This command only works when the document is opened and in edit mode. This obviously won’t be the case outside of testing.
Is there a way to make modifications to the documents through this forumla agent and save them while using formula language?
Thank you in advance for any help!
Subject: Scheduled agent in Forumla language
not quite sure what you mean, I run this kind of code very frequently as a server task to update multiple docs fast
FIELD DivisionCurrencySign := @If(DivisionCurrency = “EUR”; “€”; “$”);
SELECT @All
Subject: RE: Scheduled agent in Forumla language
Hi,
I have those sorts of commands in my agent, but the changes are not saved in the documents. When I put in the Command statement to save the document, it worked when I manually ran the agent on one selected document, but when I tried to run the agent on a schedule it could not run the command filesave statement. If I took it out, then none of the changes were saved.
Hope this is more clear.
Subject: RE: Scheduled agent in Forumla language
Are you sure the agent is set to “Modify Documents” rather than “Select Documents”? FIELD is all that’s required unless the document is open in the UI; you never need to use @Command([FileSave]) unless the document is open.
Subject: RE: Scheduled agent in Forumla language
Thank you Stan, that was it!
Subject: Scheduled agent in Forumla language
Candice,
I agree with Yazdi. There is no need in @formula language to explicitly save the docs in an agent. When you say…
FIELD xxx := 123;
…field xxx will be changed to 123 assuming no coding errors in data types, etc.
If your changes are not being saved, make sure you are not trying to set “Computed for display” fields or computed fields that are recalculating their values when the docs are reloaded, resulting in lost changes from your agent.
Run your agent without the file save and then check the field properties of the affected docs without opening the docs. You will see that your changes took effect. Now if you open the docs, that causes computed fields to recompute, so at that point, you could lose the updates. You’ll have to do some additional coding to ensure that doesn’t happen.
Ken
Subject: RE: Scheduled agent in Forumla language
also another point, is yr access to update restricted in anyway by ACL and readers/authors fields?