Lightning Web Component lightning-file-upload and edit file content A lightning-file-upload component provides an easy and integrated way for users to upload multiple files. The file uploader includes drag-and-drop functionality and filtering by file types. to use lightning-file-upload you must have recordId of the record that the uploaded file is associated with, lightning-file-upload component will appear to disable in the absence of recordId. Below code will upload the images and displays them with onclick functionality which will enable you to edit the title and description of uploaded files with delete functionality. Points to remember: 1. Not suppo rted in Lightning Out or standalone apps, and displays as a disabled input. 2. The file uploader cannot be used to u pload files with the following file extensions: .htm, .html, .htt, .htx, .mhtm, .mhtml, .shtm, .shtml, .acgi, .svg. 3. lwc file-upload multiple don't work in android, In android you canno...
Posts
Showing posts from 2019
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Salesforce Community Templates Community templates let you build responsive communities for delivering rich, branded spaces for your customers and partners. With Community Builder, you can edit the lightning template components to add information about your community, add images and CMS content with writing a single line of code. You can also create and add custom pages, build a lightning component and expose your salesforce objects. Types of Templates: 1. Aloha: A configurable App Launcher template that lets users quickly find applications and access them using single sign-on authentication, including social logins. 2. Customer Account Portal: The Customer Account Portal template improves customer relationships and decreases service costs. The template provides features that make it easy for customers to see and pay invoices, update their account information, and search your knowledge base for answers. Features: a. Lightning community pages and components b. ...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Steps to create Multilingual Community 1. Set the default language: This setting is not associated with the default language settings in your Salesforce org. By default, English is the language in which community content displays. 1.a. In the community on the left sidebar, click on the gear icon and select Languages. 1.b. Select a language in the Default Community Language. 2. Add Language to community: Click on the Add Language button and select the languages you wanted to add to your community and save your changes. once save you can select any the following settings 2.a. Active on Live Community : This checkbox controls whether the language is available to community visitors in the language selector. 2.b. Fallback Language : Controls which language to display if the selected site language is unavailable. 2.c. Display Label : This setting define the display label for each language. The display label appears in any language pick...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
AccountContactRelationship This object is used to associate a single a single contact record to multiple account records so you can easily track the relationships between the people and businesses they work with. The AccountContactRelation object supports person accounts. That means that a person account can be either a related contact on a business account or a related account on a contact. A person account can also be related to another person account as either a related contact or related account. You can query AccountContactRelation records in your developer org, below query will give you the accountcontactrelation record info. SELECT Id, ContactId, Contact.Name, AccountId, Account.Name FROM AccountContactRelation You will have to enable setting Allow users to relate a contact to multiple accounts” setting from setup > account settings for above query to work. You cannot delete AccountContactRelation record, only way to delete the records i...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Related reference Fields Value in sObject SOQL In Dynamic SOQL we create query string using Apex code at run time and use Database.Query method to fetch the results. example: String queryString = ' SELECT Id, Name, AccountId FROM Contact LIMIT 1'; sObject result = Database.query(queryString); above query will return me a contact information, if I wanted to access record's Name I can access it using sObject get() method i.e. result.get('Name') will give me Name value. Output: But the real challenge we will face when you try to access fields value from related object field, i.e. if you try to access Account.AnnaualRevenue you will get an exception 'System.SObjectException: Invalid field Account.AnnualRevenue for Contact'. To fix this we we will use getSObject() method to traverse the relationship. below code will traverse the relationship and get you the value: References: sObject Class , String Class , Martin Borthiry
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Asynchronous Apex Triggers In Summer 19 release Salesforce introduce a new feature to process data using a combination of 'Asynchronous Apex Triggers' and Change Data Capture. Any DML on Salesforce records causes platform to start a series of calculations, run business logic and database updates, all these are called as an Apex Transactions. You can reduce the Apex transaction time to complete the business logic and limit constraints by decoupling resource-intensive, non-transactional logic from database transaction and execute asynchronously. Asynchronous Apex triggers are change event triggers that run asynchronously after a database transaction is completed. They are ‘after-insert’ triggers and can be defined with the after insert keywords. They can be created the same way we create regular Apex triggers. You set the trigger to use a change event object instead of an sObject. The change event object name is suffixed with ChangeEvent. For example, Account change e...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Lightning Web Component : lightning-record-view-form A lightning-record-view-form component is a wrapper component that accepts a record ID and is used to display one or more fields and labels associated with that record using lightning-output-field . lightning-record-view-form requires a record ID to display the fields on the record. It doesn't require additional Apex controllers or Lightning Data Service to display record data. This component also takes care of field-level security and sharing for you, so users see only the data they have access to. Displaying Record Fields : To display the fields on a record, specify the fields using lightning-output-field. Attributes: NAME ACCESS ...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Lightning Web Component: lightning-record-form A lightning-record-form component enables you to quickly create forms to add, view, or update a record. Using this component to create record forms is easier than building forms manually with lightning-record-edit-form and lightning-record-view-form . However, lightning-record-form does not support client-side validation quite the same as lightning-record-edit-form . The object-api-name attribute is always required, and record-id is required if you are editing a record. NOTE: this component take cares of field-level security and sharing for you, so users will only see the data that they have access to. Modes This component accepts mode value that determines the user interaction determine for them. The values can be one of the following: a. edit : Creates an editable form to add a record or update an existing one. When updating an existing record, specify the...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Salesforce Connect Salesforce connect is a framework that enables you to view, search and modify data that's stored outside your Salesforce org. Instead of extracting and copying that data into your org using ETL tool, we can use external objects to access that data real time using web-service callouts. Salesforce recommend to use Salesforce Connect if You have large amount of data that you don't want to copy into your Salesforce org. You need small amount of data at any one time. You need real-time access to the latest data. You store your data in the cloud or in a back-office system, but want to display or process that data in your Salesforce org. External Objects: External objects in Salesforce are similar as custom objects but they are mapped to data located outside your Salesforce org. Each of the external object’s fields maps to a table column on the external system. External objects enable users to search and interact with the external data. Each or...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
SOQL Injection A SOQL injection consists of insertion or injection of SOQL query via the input data from client to application. A successful SQQL injection exploit can read sensitive data from the database. Below is the example of Apex and Lightning Component code vulnerable to SOQL injection. Now enter name existing contact name and click on search button to see the result, in my case I search for contact whose Name contains 'Winter'. Now in search box enter " winter%' OR Name LIKE ' " and click on search button to all contact records. How to prevent SOQL injection? 1. Static Query: To prevent SOQL injection attach, avoid using dynamic SOQL queries. Instead, use static queries and binding variables. 2. Escaping Single Quotes: use of string.escapeSingleQuotes() method arounf variable function escapes any instance that it finds of a ‘ quote in the string using the backslash (\) escape character. This prevents an attacker’s input from...
- Get link
- X
- Other Apps
By
Puneet Mishra
-
lightning:map component lightning:map introduced in winter 19 which can be use display a map of one or more locations using Google Maps. We can pass markers to the component to define the locations to map. A marker can be a coordinate pair of latitude and longitude, or a set of address elements: City, Country, PostalCode, State, and Street. This component requires API version 44.0 and later. lightning:map has required attribute mapMarkers which accepts array of markers that indicate location. A market contains Location information: This can be a coordinate pair of latitude and longitude, or an address composed of address elements. Descriptive information: This is information like title, description and an icon which is information relevant to the marker but not specifically related to location. Example Create a new Object called 'Tower' with two new custom fields 1. Field Label: State Type: Master-Detail (Account) 2. Field Label: Locati...