?
Solved

Run agent on Created Only

Posted on 2003-03-04
25
Medium Priority
?
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

771 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