In this guide, we will explain how to open an external link or schema URL from the Formyoula app.
For example, if you want to open a Salesforce record in the browser or the Salesforce1 mobile app from the Formyoula app form.
I.e.
salesforce1://sObject/00128000006JkVn/view
or
https://ap7.salesforce.com/00128000006JkVn
or
https://custom-domain.lightning.force.com/lightning/r/Account/0012400000EozgmAAB/view
The simplest approach is to use an HTML link with the target set to the system - target="_system"
<a target="_system" href="https://custom-domain.lightning.force.com/lightning/r/Account/0012400000EozgmAAB/view" class="btn btn-primary" role="button"> Open Record In Salesforce App</a>
Create a HTML link tag using HTML element.
<a id="sfdc_on_browser" href="#" class="btn btn-primary" role="button"> Open Account in browser </a>
</br>
<a id="salesforce1_app" href="#" class="btn btn-primary" role="button"> Open Account in Salesforce 1 App</a>
Add a JavaScript field with the below JavaScript.
// Open link in the Salesforce app
$( '#salesforce1_app' ).click( function() {
// 4d1c-94fb-defa : Component Id of field which contain valid record id. i.e A lookup
var id = formyoula.form_fields[ '4d1c-94fb-defa' ] ? formyoula.form_fields[ '4d1c-94fb-defa' ].get( 'value' ) : '';
// Open link
window.open( 'salesforce1://sObject/' + id + '/view', '_system' );
} );
// Open link in a browser
$( '#sfdc_on_browser' ).click( function() {
// 4d1c-94fb-defa : Component Id of field which contain valid record id. i.e A lookup
var id = formyoula.form_fields[ '4d1c-94fb-defa' ] ? formyoula.form_fields[ '4d1c-94fb-defa' ].get( 'value' ) : '';
// Open link
window.open( 'https://ap7.salesforce.com/' + id, '_system' );
} );
Open a Mobile or Web app to try an external link.
For any questions, please contact us - [email protected] or the Formyoula in-app chat 🙂