Code samples for triggering telephone, text and e-mail applications.
Sample data used in the examples:
var person = {
name : "John Smith",
tel : "+49 62227
747474",
sms : "+49 173 123456",
email : "john.smith@sap.com",
website : "http://www.sap.com"
};
You can trigger an external application at any time, but it is usually triggered as a reaction to a UI control throwing an event. The next sections illustrate some of the most typical use cases.
The following button can be used to place a call.
new sap.m.Button({
text : person.tel,
icon : "images/action.png", /* Depends where your images are located */
press : function() {
sap.m.URLHelper.triggerTel(person.tel);
}
});
The following code snippet gives an example for triggering an e-mail application. You can also set the subject and message of the e-mail application:
new sap.m.Image({
src : "images/website.png", /* Depends where your images are located */
press : function() {
sap.m.URLHelper.triggerEmail(person.website, "Info", "Dear " + person.name + ",");
}
});
DisplayListItem
with active feedback is the most popular use case for the following example.
new sap.m.DisplayListItem({
label : "Sms",
value : "( " + person.sms + " )",
type : "Active",
press : function() {
sap.m.URLHelper.triggerSms(person.sms);
}
});
To use any other control inside the list, use InputListItem
:
new sap.m.InputListItem({
label : "Website",
content : new sap.m.Button({
text : person.website,
press : function() {
sap.m.URLHelper.redirect(person.website);
}
})
});