Official Content

The SendMessage method offered by the Interop external object allows sending general messages using applications installed on the end user's device. 

Interop-SendMessage-GX18

Two parameters can be set:

  • Message: The content of the message.
  • To: The recipient of the general message (e.g. by phone number, email, Facebook account, Twitter username, etc.).


The method will display every application installed on the end user's device for sending the message without considering the semantics of the To parameter (phone, email, etc.). The end user should select which app should resolve the request; otherwise, the To parameter will be ignored. For instance, if the To parameter is set under the Phone domain, and the end user tries to send the message by email, only the Message parameter will be used.

To use the method, follow the steps below:

Step 1

Consider the following Transaction objects:

Customer
{
  CustomerId*
  CustomerName
  CustomerPhoto
  CustomerPhone
  CustomerEmail
  CustomerAddress
  CompanyId
  CompanyName
}
Company
{
  CompanyId*
  CompanyName
}

Step 2

Apply the Work With pattern to the Customer Transaction.


Step 3 

Go to the Section (General) node located under the Detail node. From the Layout tab, right-click on the Application Bar and insert a button as follows:

WW-Layout-AppBar-InsertButton-GX18

Step 4

Add the following behavior to the Message event: 

Event 'Message'
    Interop.SendMessage("",CustomerPhone)
EndEvent

This action will try to send an empty message to a specific customer (in this case, using the phone number). If the end user selects the SMS messaging app, it will directly be opened to send the message to the target user. However, if the end user selects the Email app, it will only open the email application because the message is empty and the phone number is discarded. If you only want to send SMS, use the SendSMS method.

At runtime, it will behave as follows:

SendMessage-Runtime_png

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant