Are you trying to improve your Salesforce Area Service Cellular App with customized performance?
On this information, we’ll stroll you thru the steps so as to add a Lightning Internet Element (LWC) Fast Motion to the Area Service Cellular App.
Through the use of Lightning Internet Element Fast Actions, you may introduce customized options that transcend the usual capabilities of the Area Service Cellular App, enabling a extra tailor-made person expertise.
Prerequisite: Allow Lightning SDK within the Area Service Cellular App
Earlier than continuing, be certain that you’ve accomplished the next:
- Navigate to the System Permissions of the permission set assigned to your Service Useful resource.
- Allow the checkbox for “Allow the Lightning SDK for on-line and offline use within the Area Service cell app.”
- Be aware: If the Lightning SDK for Area Service Cellular org setting is enabled, it’s going to override this permission.
With out this important setting, the Lightning Internet Element Fast Motion won’t seem within the Area Service Cellular App.
Why Use Salesforce Area Service Cellular App?
The Area Service cell app for Android and iOS gives a complete software for in the present day’s cell workforce.
Constructed with an offline-first strategy, it means that you can work and save modifications even with out web entry. It’s also possible to customise the app to fulfill your particular enterprise necessities.
What’s a Lightning Internet Element Fast Motion?
Lightning Internet Element (LWC) fast actions empower customers to carry out duties in Salesforce with ease by immediately invoking customized Lightning Internet Elements on report pages.
With customized fast actions, you streamline navigation and workflows, giving customers fast entry to an important data.
These intuitive UI buttons improve productiveness by delivering the instruments and information they want at their fingertips.
How one can Set Up a Lightning Internet Element as a Fast Motion on a Document Web page?
Arrange a Lightning Internet Element (LWC) as a fast motion on a report web page by defining the metadata within the
file.
Specify a lightning__RecordAction
goal and set isExposed
to true
to make the element accessible as a fast motion.
62.0 true lightning__RecordAction
Comply with these easy steps to create a Lightning Internet Element (LWC) Fast Motion in Salesforce and add it to the web page structure:
- Navigate to Setup.
- Go to Object Supervisor and choose the thing the place you wish to create the Fast Motion.
- Click on on Buttons, Hyperlinks, and Actions after which choose New Motion.
- Select Motion Kind as Lightning Internet Element.
- Choose the specified element, specify the title and label, and click on Save.
- Add the newly created Fast Motion to the Web page Format of the thing.
Use Case: Enhancing Work Order Administration with LWC Fast Motion
Think about utilizing an LWC Fast Motion that permits Service Useful resources to effortlessly add and look at photographs associated to a Work Order.
This function streamlines work order administration, enabling subject technicians to doc and entry visible data immediately throughout the Salesforce Area Service Cellular App.
The Fast Motion is labeled as Attachments
The Following Apex class will work because the controller for the Lightning Internet Element Fast Motion
public with sharing class FileClass { /** * @description Methodology to retrieve the associated photographs * @param linkedEntityId the Salesforce recordId * @return `Checklist` Checklist of associated photographs */ @AuraEnabled public static Checklist wkGetFiles(String linkedEntityId){ Checklist fileTypes=new Checklist {'JPEG','JPG','PNG'}; Set contentDocumentIds = new Set (); for (ContentDocumentLink hyperlink : [ SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId =:linkedEntityId ]) { contentDocumentIds.add(hyperlink.ContentDocumentId); } return [ SELECT Id, Title, ContentDocumentId, FileType, VersionData FROM ContentVersion WHERE ContentDocumentId IN :contentDocumentIds AND IsLatest = true AND FileType IN:fileTypes ORDER BY CreatedDate Asc ]; } /** * @description Methodology to create ContentVersion information * @param fileName Identify of the file * @param base64Data the picture transformed to base64 * @param parentId RecordId of the associated report * @return `String` report Id of the inserted * @exception */ @AuraEnabled public static String createContentVersion(String fileName, String base64Data, String parentId) { strive { // Decode the base64 string Blob fileBody = EncodingUtil.base64Decode(base64Data); // Create the ContentVersion report ContentVersion contentVersion = new ContentVersion(); contentVersion.Title = fileName; contentVersion.PathOnClient = fileName; contentVersion.VersionData = fileBody; if (String.isNotBlank(parentId)) { contentVersion.FirstPublishLocationId = parentId; // Hyperlink to a report (optionally available) } insert contentVersion; // Return the Id of the created ContentDocument return contentVersion.Id; } catch (Exception e) { throw new AuraHandledException('Error importing file: ' + e.getMessage()); } } }
The Lightning Internet Element might be carried out like this
HTML File
Attachments
Javascript File
import { LightningElement,api,monitor } from 'lwc'; import wkGetFiles from "@salesforce/apex/FileClass.wkGetFiles"; import createContentVersion from "@salesforce/apex/FileClass.createContentVersion" export default class wkWorkOrderAttachments extends LightningElement { @api recordId; @monitor information=[]; imgList=[]; showFile=false; showSpinner=false; fileName; fileContent; isUploadDisabled=true; connectedCallback(){ this.getRelatedImages(); } getRelatedImages(){ this.showSpinner=true; wkGetFiles({linkedEntityId:this.recordId}).then(response=>{ if(response!=null){ this.imgList=response; for(let i=0;i{ const base64 = reader.consequence.break up(',')[1]; this.fileContent = base64; this.isUploadDisabled = false; }; reader.readAsDataURL(file); } } async uploadFile() { if (this.fileContent && this.fileName) { this.showSpinner = true; strive { const consequence = await createContentVersion({ fileName: this.fileName, base64Data: this.fileContent, parentId: this.recordId, }); this.uploadedFileId = consequence; this.showSpinner = false; this.isUploadDisabled = true; this.information=new Array(); this.fileContent=null; this.fileName=null; this.connectedCallback(); } catch (error) { this.showSpinner = false; } } } refreshView(){ this.isUploadDisabled = true; this.information=new Array(); this.fileContent=null; this.fileName=null; this.connectedCallback(); } }
Instance
Conclusion
The Area Service Cellular App is a robust software designed for subject technicians to effectively handle duties on the go.
It gives customizable options that combine seamlessly with Salesforce Area Service, enabling companies to streamline operations and improve buyer satisfaction.
Moreover, Lightning Internet Element Fast Actions allow customers so as to add customized options that extends capabilities of the Area Service Cellular App.
For any queries concerning Area Service Lightning or customized options, contact our professional Salesforce Consultants at [email protected] or through Stay Chat.
Our workforce is obtainable year-round to supply personalized options tailor-made to what you are promoting wants.