Objective
After reading this article, you will understand how Youreka's Lightning Components work, common reasons for using them, and important considerations for implementing them.
Before you get started
This article might be helpful before you read further:
Introduction to Youreka's Lightning Components
It may be important to you to be able to concurrently review information in Salesforce while completing forms in Youreka. To accomplish this, you can utilize Youreka's Lightning Components.
Youreka's Components
There are three Lightning Components that come with the Youreka Managed Package. The three components are listed here, and correspond to the numbers in the screenshot below.
- Youreka New Form Button
- Youreka Forms Related List
- Youreka Form
Youreka New Form Button
The New Form Button component allows desktop users to quickly create forms while on a Lightning Page in Salesforce. Each button is associated with a Form Template so the system knows which type of form to create. When setting up each button, admins can define how the form's lookups will be populated when the form is created.
When these buttons are clicked, the system creates a Form record with the lookups populated, and renders the form in the Youreka Form component on the page (item 3 pictured above). See below for more information about how the Youreka Form component works.
Youreka Forms Related List
The Youreka Forms Related List component (item 2 above) is similar to standard related list. It behaves in the same way that regular related lists do, in that all the forms related to the current record will show in a list format on the page. The only difference is that this component also lets users select forms from the list, and immediately view/edit them on the page in the Youreka Form component.
Youreka Form
The Youreka Form component is simply a space where Form records are rendered. In order to display the correct form, this component relies upon information from the New Form Button, or Forms Related List component.
As stated above, each of these components can be configured in the Lightning App Builder while creating or editing Lightning Pages.
Launching Youreka's LWCs From URLs
It's possible to interact with Youreka's Lightning Web Components with URLs to a page where those components exist.
Launching New Form Records From URLs
As an example, if you wished to navigate to a Contact Lightning Page, and automatically open the Youreka LWC with a new Form record, an admin could use the following link to do so.
/apex/disco__NewFormWizard?templateID=TEMPLATEID&FORMLOOKUP={!Contact.Id}&lwcRet=<lwc-ret>
Parameter | Explanation |
disco__NewFormWizard | A managed Youreka visualforce page that can be called to create a new form record |
templateId | The Form Template ID that you wish to use for the new Form record |
formlookup | This should be replaced with the lookup field on the Form object (e.g. disco__Form_Contact__c) |
lwc-ret | This should be replaced with the page that the Youreka Form LWC is on (e.g. /lightning/r/Contact/{!Contact.Id}/view) |
Launching Existing Form Records From URLs
If an admin wanted to let users navigate to a page, and open the Youreka LWC with a Form that already exists, they can simply build a URL and append c__formIdLWC=<form-id>, to the URL, replacing <form-id> with the 18-digit Form record ID you wish to open.
Developer Information
To load a Youreka Form in the Youreka Form Lightning Web Component using a custom Lightning Aura Component:
-
Add the auraPubsub to the component:
<disco:auraPubsub aura:id="auraPubsub" />
-
Create a method in the component javascript controller that creates a payload object and fire a pubsub event.
var auraPubsub = component.find('auraPubsub'); var payload = {
formId: “a0J1C00000ePRHkUAO”,
isFormDetail: true };
auraPubsub.fireEvent('yFormSelected', payload);
- Add the auraPubsub to the component:
<disco:auraPubsub aura:id="auraPubsub" />
- Create a method in the component javascript controller that creates a payload and fire a pubsub event. A lookup that inserts a field link record should have the string “NEW” in the place of an id.
var auraPubsub = component.find('auraPubsub'); var payload = {
"disco__Form_Template__c":"a0I5B000004H2LUUA0",
"disco__Form_Contact__c":"0035B00000DHgNNQA1",
"disco__Form_Account__c":"NEW"
};
auraPubsub.fireEvent(‘createNewYForm’, payload);
- If the template referenced in the payload has lookups that are not also specified in the payload, then the end user will be required to select records for those lookups each time a new form is created.
Configuration When Clickjack Protection Is Enabled
- Navigate to Setup -> Session Settings
- Under Whitelisted Domains for Visualforce iFrames, enter your org's domain (i.e. https://my-company.lightning.force.com.
Considerations for Using Lightning Components
- It is important that your Salesforce org has My Domain enabled.
- The maximum number of Youreka New Form Button Components that can added to a single page can vary by org based on the number of published templates.
- The Record Ids for FORM LOOKUPs can either be a specific record Id or a field relative to the current page. For example, if you are creating a record page for Contacts and you using a template that has Contact and Account Fields Links, for the disco__Form_Contact__c lookup you can enter this Record.Id into the Record Id field and any forms created by that button will populate the field link with the Id of that page’s contact record. For the disco__Form_Account__c lookup you can enter thisRecord.AccountId into the Record Id field and any forms created by that button will populate that field link with that page’s Contact’s AccountId.
-
On a Record Page in a community, the LWC button cannot be placed in the Template Header or Template Header Bottom if you are going to use the thisRecord approach. It must be placed in on the record page itself.
-
The Lightning App Builder will not validate that you have set the correct information relative to the template. You will have to test the button to see any errors.
-
Only one Youreka Form Component should be added to a single page.
-
Only one Youreka Related List Component should be added to a single page.
Comments
0 comments
Please sign in to leave a comment.