Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Run agent on Created Only

Posted on 2003-03-04
25
Medium Priority
?
249 Views
Last Modified: 2013-12-18
What is the best method for running an agent on only created docs, not modified.  Can anyone assist.

Thanks, Adam
0
Comment
Question by:christmann
  • 7
  • 5
  • 5
  • +5
25 Comments
 
LVL 4

Expert Comment

by:Stan Reeser
ID: 8067124
check for the IsNewNote property in our script
i.e.
If doc.IsNewNote Then
  Messagebox( "This document has not been saved. It's new." )
Else
  Messagebox( "This document has been saved. It's not new." )
End If
0
 
LVL 4

Expert Comment

by:pratigan
ID: 8067129
This depends upon how often you want to have the agent run, how many documents you expect to be created daily, you want the agent to run after created but before updated again.  If your concerned about the agent running boefre any updates are done, then the agent will need to run every time a document is created.  Let me konw more details if you need assistance with the agent coding...
:)
0
 
LVL 4

Expert Comment

by:Stan Reeser
ID: 8067142
In case its not clear... just replace the first Messagebox stuff with what to do if it "IsNewNote"  the else is only necessary if you want it to do something else if it has already been saved
0
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.

 

Author Comment

by:christmann
ID: 8067193
The documents will not be edited or modified by users, the only thing that may happen is the form itself needs to be edited.  So, I want to eliminate the chance of the agent running on all docs if I need to alter a field on the form.  The agent sends an email to a couple of individuals.  I figured if I run it on newly created docs only, this would eliminate the chance of a widespread email.
0
 
LVL 4

Expert Comment

by:Stan Reeser
ID: 8067233
Just read pratigan's response...

Seems one of us was on the wrong track...you'll have to tell us who.  As for running an agent on documents that have not been modified after creating just check number of items in the Authors property array and run on those where it is  = 1
0
 

Author Comment

by:christmann
ID: 8067285
So if someone created the doc then I need to modifiy the form, the Authors Property array would still be set to 1?

Do you have an example of this.  Would I put this script in the Document Selection of the agent?

I would like the agent to run on create, it is very important that the information is sent immediately.

Thanks
0
 
LVL 7

Expert Comment

by:scottrma
ID: 8067394
Use the $Revisions special field to determine if the document is new or not. In a newly saved document (saved only once), this field will be absent. When the document is saved a second time (after the initial save), the field $Revisions is added to the document. So in your agent check for the presence/absence of this field.

If it is a formula agent:

SELECT @IsAvailable($Revisions);

If it is a LotusScript agent:

If doc.HasItem("$Revisions") Then
     'Process document
Else
     'Do nothing here and go to next document in collection
End If

If you need more help with this, let us know.

Regards,

Scott
0
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8068399
I use a flag field, set by the agent.  Set the agent to run on modified documents, then:

if lotuscript:

if doc.hasitem("agentflag") then exit sub
doc.agentflag = "alreadydone"
call doc.save(false,false)

if formula language:

@If(doc.agentflag = "" ; "" ; @Return(""));
field agentflag := "alreadydone";

0
 
LVL 9

Accepted Solution

by:
Arunkumar earned 400 total points
ID: 8070863
Mine is similar to AJPs!

Create a computed field with formula

@If(@IsNewDoc;"RunAgent" ; "Dont Run Agent")

Create a view to select the document that has only "RunAgent".  While the agent processes each document change this value to "Dont Run Agent" and save the document.

The documents processed by agents will get out of the view and not be processed next time.

:-)
Arun.
0
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8071120
Arun, that's because you're such a smart guy!
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8071240
Soon I will be working fulltime for EE.  You know why ?
0
 
LVL 4

Expert Comment

by:pratigan
ID: 8071244
Instead of an agent... if your sending an email based upon a new document created in a form, then use the @MailSend function in the save event of the form and set the formula up to use @IsNewDoc as a test and then upon close, send the email using @MailSend.  This way its very straight forward and easy to maintain.
Let me know if this is something you would like to persure...
:)
0
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8071250
why's that, Arun?
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8071266
Because my current assignment will be over in the next couple months.

:-(
0
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8071298
sorry, Arun.  I'm assuming then that you do contract work, not full time employment?
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 8071819
Damn I took a look for the first time in a year and I said to myself...'lets try and answer this q'...and I find tens of posts....I think Adam got more than he asked for:)

Arun back on the bench buddy!

-Gus
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8071969
Not yet Gus ! Not yet....

Remember Gladiator movie ?  The last dialogue is this !

Welcome back Long Lost Buddy...
:-)

AJP: YES! I am working as a contractor.
0
 

Author Comment

by:christmann
ID: 8073777
This worked well.  Thanks for the advice.  Adam
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8073974
And why a "B" ???
0
 

Author Comment

by:christmann
ID: 8074096
No reason, I just kept the rating at the default.  It solved my problem, so it is an "A".  Thanks again, Adam
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8074244
Well, to my knowledge it does not default to anything.  Selecting Excellent gives an "A".  Shall I request for a "A" with your permission ?
0
 

Author Comment

by:christmann
ID: 8074260
yes, please do.  Thanks again, Adam
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8074280
:-)
0
 
LVL 1

Expert Comment

by:Computer101
ID: 8076221
Grade changed as requested

Computer101
E-E Admin
0
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8086068
Arunkumar;

I tried to find your email address, but failed.  Drop me an email (mines in my profile) -- I'd like to talk offline with you WRT your contracting.  I may know someone who could use help, and I'd like to put you in charge.  As you know, I do consulting but not contracting, so sometimes people contact me looking for contracting and I have to refer them.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question