Creating Document executing @command - alternative

I need some help. I have a button on a document that executes some @commands. I want these commands to execute automatically when creating a new document. I know (from experience) that @commands and other ui functions are not supported in that context. Is there an alternative to automatically executing @commands at document creation?
schmad01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SysExpertCommented:
Well, you could put the commands in the Queryopen or querysave of the Form.

It depends on the commands.

It would be best to copy and paste them here for examination.

I hope this helps !
0
marilyngCommented:
Depending on the command and what you're trying to do,  you can put them into the post open (I don't know about the query open, I think you'd have to wait until the document was available in the UI, and committed to edit more or not)

You can try a computed field either at the top or bottom of the form with the commands either in the computation, but the last line being the field name, or you can possibly put them in the validation event of a field at the bottom of the form.

Either will need some debugging checks, because if they don't run right, then the form won't open at all.  You also will have to check for isdocbeingedit, or isdocbeingsaved... etc.
0
Sjef BosmanGroupware ConsultantCommented:
And don't be too cryptic, but let us have a look at your @Commands. A vague question will only lead to vague answers...
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

schmad01Author Commented:
Just trying to start a dialogbox: @DialogBox("SelectionPop"; [AutoHorzFit] : [AutoVertFit]);

in a computed when composed field. I understand why dialogbox won't work - because there is no saved document to act on. Is there a script alternative where the pop up uses radio buttons to select from or would I have to use something like an @Prompt([OkCancelList])?
0
marilyngCommented:
fastest way is to open designer help and look at the examples for:

@DialogBox, @Prompt, and then the workspace.dialogbox and workspace.prompt.

I personally wouldn't put a dialog box command in a computed when composed field.   You can put it under a button and then hide the button when you no longer need it.

Or you can put it in a computed field, as long as you're setting values in other fields and testing for when it should or should not appear.

Again, repeating what sjef says:  don't be too cryptic.. what is it that you're trying to do?

0
schmad01Author Commented:
I'm just trying to start a form and rather than have the user click a button on the form to bring up the dialogbox, I would rather it come up automatically.
0
Sjef BosmanGroupware ConsultantCommented:
And it must be Formula language? Can't you use LotusScript from the QueryOpen event? I suppose it will work.
0
schmad01Author Commented:
No, it doesn't have to be formula. I just don't know how to write script.
0
Sjef BosmanGroupware ConsultantCommented:
Just some quick code then, in LotusScript:
- open the form
- put this code in the Global section of the form
    Dim dbdoc As NotesDocument ' global, so it can be used later on as well
- put this code in the QueryOpen-event:
    Dim ws As New NotesUIWorkspace
    Dim ns As New NotesSession
    Dim db As NotesDatabase

    If Not IsNewDoc Then Exit Sub
    Set db= ns.CurrentDatabase
    Set dbdoc= New NotesDocument(db)
    Continue= ws.DialogBox("SelectionPop", True, True, ,,,, "Title", dbdoc)
    If Not Continue Then
        Set dbdoc= Nothing
    End If
- put this code in the PostOpen-event
    Dim doc As NotesDocument

    Set doc= Source.Document
    If Not(dbdoc Is Nothing) Then
            doc.SomeField= dbdoc.SomeField(0) ' if there are more fields, code should be added to copy them
            Set dbdoc= Nothing
    End If
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
schmad01Author Commented:
Will try, sjef.
0
schmad01Author Commented:
Sorry, almost forgot about this question. Anyway the solution helped me out immensely. Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.