Share via


SendInstantMessageWithLinks Method

The SendInstantMessageWithLinks method sends an instant message with links to the specified contacts.

Syntax

object.SendInstantMessageWithLinks

(

i_pIToContactURLEnumAsIGrooveBSTREnum,

i_BodyAs String,

i_LinkObjectsAsIGrooveUnknownEnum,

i_TrackMessageAs Boolean = True,

i_SaveSentMessageAs Boolean = False

) As Boolean

Parameters

Parameter Description

i_pIToContactURLEnum

Specifies the contacts to send the instant message to. The string enumeration specifies Contact URLs, which can be obtained from the CreateMemberNameURLEnum method or a field value in a record. See Using Contacts in Forms for more information.

i_Body

Text of the message to send.

i_LinkObjects

Links to be appended to the text. See Remarks for more information.

i_TrackMessage

TRUE if the message should be tracked (default), FALSE otherwise.

i_SaveSentMessage

TRUE if the message should be saved, FALSE otherwise (default).

Return Value

The return value is TRUE if the user grants permission for the script to send the message; FALSE otherwise.

Remarks

When a script calls this method, Groove displays a dialog box asking if the user wants the Forms tool to send an instant message on the user's behalf. If the user grants the tool permission to send the message, the method returns a TRUE value. If the user does not grant the tool this permission, the method returns a FALSE value. Note that a TRUE value does not indicate that Groove succeeded in sending the message, only that the user granted permission to send it.

The body of the instant message consists of the text specified by the i_Body parameter followed by the links specified by the i_LinkObjectsParameter. The links can be links to the Forms tool, a record within the Forms tool, or a view within the Forms tool.

Each link is specified by an IGrooveFormsToolLinkObject object. If you specify that the link is to a record or view, then you must also specify the Record ID or the View ID.

The links are specified by an IGrooveFormsToolLinkObjectEnum object, but when you specify this object in the i_LinkObjects parameter, you should specify it using its IGrooveUnknownEnum interface.

The IGrooveFormsToolLinkObject and IGrooveFormsToolLinkObjectEnum objects are created with the CreateLinkObject and CreateLinkObjectEnum methods.

Note

This method displays a modal dialog and should not be called from a script when a transaction is open. Macros are run within an open transaction; consequently, this method should not be called from a macro. See Accessing Forms Records for more information on this restriction.

Example

The following sample gets a Contact URL from a Contact field in the saved record and sends an instant message with a link to the current record.

  var app = GetApp();
  var record = GetFormRecord();
  var contact= record.OpenField("ProjMgr");
  if (contact)
  {
    var URLEnum = CreateBSTREnumFromArray([contact.ContactURL]);
    var recordID = GetRecordID();
    var linkObject = app.CreateLinkObject(
      "Item requiring attention",
      GrooveFormsToolLinkType_Record,
      recordID);
    var linkObjectEnum = app.CreateLinkObjectEnum();
    linkObjectEnum.IGrooveUnknownEnumCreate.Add(linkObject);
    var approved = app.SendInstantMessageWithLinks(URLEnum,
      "Please check status of following:",
      linkObjectEnum.IGrooveUnknownEnum);
    if (!approved)
    {
      app.DisplayOKMessageBox("Did not send IM, user refused permission to send");
    }
  } 
  else
  {
    app.DisplayOKMessageBox("Cannot send IM, no contact in saved record","Error");
  }

See Also

Reference

IGrooveFormsToolLinkObject Interface
IGrooveFormsToolLinkObjectEnum Interface
IGrooveFormsToolUIDelegate Interface
CreateLinkObject Method
CreateLinkObjectEnum Method
CreateMemberNameURLEnum Method
SendInstantMessage Method
GrooveFormsToolLinkType Type

Concepts

Using Contacts in Forms