This guide includes the basic Javascript examples of displaying Buttons in the Formyoula alert box. We can use the following event.
formyoula.event_trigger( 'app:alert:display', {
title: 'Form Submission',
message: "Hey! Thanks",
dismissable: true,
fadeOut: 0,
center: true,
type:'success',
} );
We can customize the properties like message, dismissable, fadeOut, center, and type according to the requirement.
Customizing the alert view to show two Buttons to open records selected in a lookup in a web browser or on the Salesforce1 app.
var id = formyoula.form_fields[ 'Record Lookup' ].get( 'value' );
var alert_view =
'<div class=btn-group-vertical>' +
'<a href="https://ap7.salesforce.com/' +
id +
'"' +
'class="btn btn-default btn-lg" role=button>Go to Salesforce</a><br>' +
'<a href="salesforce1://sObject/' +
id +
'/view" class="btn btn-default btn-lg" role="button">Go to Salesforce1 App</a>' +
'</div>';
formyoula.event_trigger( 'app:alert:display', {
title: '',
message: alert_view,
dismissable: true,
fadeOut: 0,
center: true,
type: 'success'
} );
Show Alert on click of submit button.
// On click of submit button
$( '.finish' ).on( 'click', function() {
// id of the record selected in the lookup
var id = formyoula.form_fields[ 'Record Lookup' ].get( 'value' );
// Using Bootstrap to create a simple Navs to open record selected in lookup in web browser or salesforce1 app
var alert_view =
'<div class="btn-group-vertical">' +
'<a href="https://ap7.salesforce.com/' +
id +
'"' +
'class="btn btn-default btn-lg " role=button>Go to Salesforce</a><br>' +
'<a href="salesforce1://sObject/' +
id +
'/view" class="btn btn-default btn-lg" role="button">Go to Salesforce1 App</a>' +
'</div>';
// Add a delay for the alert to display after the standard submit alert
setTimeout( function() {
// Formyoula alert event
formyoula.event_trigger( 'app:alert:display', {
title: '',
message: alert_view,
dismissable: true,
fadeOut: 0,
center: true,
type: 'success'
} );
}, 2000 );
} );
Alert with Buttons to view records in Browser or Salesforce1 app.
We can use Bootstrap contents https://getbootstrap.com/docs/4.0/components/alerts/ to customize views. For any questions, please contact us - [email protected] or the Formyoula in-app chat 🙂