Lotus Script errors type Mismatch

Posted on 2014-07-14
Medium Priority
Last Modified: 2014-07-14
Lotus scripting is getting over my head.

I have an issue I'm working on within an agent.  I have an autogenerated email  that builds the body of the email and then sends it.  within the message I want to send a value from the form that is getting selected for the email.  I have this AppendText :
Call rtitem.AppendText( "Incident Source:  " + src + Chr(13) + Chr(13) + "This is a Daily Notification Process indicating you have an open IR older than 5 days that Requires your attention. " + Chr(13) + "Please Open, Review and Update the IR." + Chr(13) + Chr(13) + "A Final Root Cause and Resolution are Required. " + Chr(13) + Chr(13) + "Thank You !" + Chr(13) + Chr(13) + "Open IR Document Link  ->  " )
            Call rtitem.AppendDocLink( curdoc, doc.Subject( 0 ) )

this is just a message body of the email.  I'm trying to add the first part, "Incident Source:  " + src + Chr(13) + Chr(13) +
the 2 chr gives me 2 line feeds.  The problem is when trying to add field value src I get the mismatch
I have it defined above as Dim src As NotesItem and then Set src = curdoc.GetFirstItem( "Incident" )

plus I'm trying to add the src value to the error at the end if there is one in this.
MsgBox "Error in Send: " + src & Error$

Question by:pratigan
LVL 46

Accepted Solution

Sjef Bosman earned 2000 total points
ID: 40194816
Hi Paul,

A NotesItem is not a valid operand for the plus-operator that you use to concatenate strings. The ampersand-operator is more lenient when it comes to concatenation, but in this case it wouldn't have mattered: you simply cannot concatenate a string with a NotesItem. Try src.Text instead, for a quick fix.

I personally almost never work with GetFirstItem, when I know the type of the value of the field. If the Incident field contains one string value, you may get it using
   Dim s As String
   s= curdoc.GetItemValue("Incident")(0)
The call returns an array of values, so you need the (0) to get its first value.

Just another remark: instead of the chr(13) call you can
- use Chr$(13): this is a string, whereas Chr(13) returns a Variant which needs a conversion
- use rtitem.AddNewline(1): this is platform-independent, Chr$(13) is ASCII

Author Comment

ID: 40194990
Fantastic... Sjef .. you are truly a master.
Thank You So Much !!

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

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.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

862 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