This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Mar 6, 2018, 2:33 PM
2 Posts

Looking for a little script help

  • Category: Administration
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 2

So I am looking for a simple script that would be something like:

If (Username Field does not contain @staff.xyz.com, then append Field Shortname + "@staff.xyz.com")

Else do nothing.

 

I'm not sure how to code this.  I would then trigger this script by selecting person doc and choosing the agent from the Actions menu.

 

Can anyone give me any insight on how to go about doing this?

 

Thanks

Mar 6, 2018, 7:28 PM
2 Posts
Sample Script - here you go

Hi Joseph,

This is small script and it doesn't cover all scenarios yet but it should be enough to get you started.
 

Sub Initialize
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim coll As NotesDocumentCollection
    Dim doc, nextdoc As NotesDocument
    Dim item As NotesItem
    Dim count As Integer
    Dim newname As String
    
    Set db = s.Currentdatabase
    Set coll = db.Unprocesseddocuments
    Set doc = coll.GetFirstDocument
    
    While Not doc Is Nothing
        count = 0
        Set nextdoc = coll.Getnextdocument(doc)
        Set item = doc.GetFirstItem("FullName")
        ForAll username In item.Values
            If InStr(1, username, "@abc.com")>1 Then
                count = count + 1                
            End If
        End ForAll
        If count > 0 Then
            MessageBox "Valid email address found in Username!"
            GoTo MovingOn
        Else
            newname = doc.ShortName(0) + "@abc.com"
            Call item.AppendToTextList(newname)
            Call doc.Save(False,False)
            MessageBox "Valid email address not found! New entry added!"
        End If
MovingOn:
        Set doc = nextdoc
    Wend            
End Sub

Mar 6, 2018, 7:48 PM
2 Posts
Thank you

Thank you very much.  This will give me something to go on.  I will play around with it.


Thanks again,

 

Joe


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal