Please like,follow,bookmark,subscribe this site to receive daily updates.
LinkedIn Group - Srinivas4sfdc (I Love Coding... You?)
FaceBook Page - I Love Coding. You?
Please like,follow,bookmark,subscribe this site to receive daily updates.
The use case here is I want to check whether case email is available given in the list of email ids or not? If it's present in the list it will return true else it will return false.
IF(
FIND(Your Email Filed,'test@gmail.com,man.6233@gmail.com,hello@haptik.co,pk.kk@gmail.com,support@jugnoo.in,msj@gmail.com,mailer-daemon@amazonses.com,sales@kks.com,l.dyj@licindia.com') > 0,TRUE,FALSE
)
Example:
IF(
FIND(SuppliedEMail,'test@gmail.com,man.6233@gmail.com,hello@haptik.co,pk.kk@gmail.com,support@jugnoo.in,msj@gmail.com,mailer-daemon@amazonses.com,sales@kks.com,l.dyj@licindia.com') > 0,TRUE,FALSE )
Let's assume we are getting list of records from the apex to js controller and for some reasons if we want to add new row how can we add to it we can see below.
import { LightningElement, api, track, wire } from "lwc"; import fetchActivities from "@salesforce/apex/CancelFlowCntrl.fetchCanActivities"; const columns = [ { label: 'ticketvalue', fieldName: 'totalTicketvalue' }, { label: 'refundedAmount', fieldName: 'totalRefundedAmount' }, { label: 'cancellationCharges', fieldName: 'totCancellationCharges' }, ]; export default class ActivitiesFlow extends LightningElement { @track allActivitiesData; @wire(fetchActivities, { recdId: '$sfrecordId' }) wiredActivities({ error, data }) { if (data) { this.allActivitiesData = data; var newItem = {"totalTicketvalue": 100,"totalRefundedAmount": 90,"totCancellationCharges":10}; this.allActivitiesData.push(newItem); } else if (error) { this.error = error; this.allActivitiesData = undefined; } } }
import { LightningElement, api, track, wire } from "lwc"; import fetchActivities from "@salesforce/apex/CancelFlowCntrl.fetchCanActivities"; const columns = [ { label: 'ticketvalue', fieldName: 'totalTicketvalue' }, { label: 'refundedAmount', fieldName: 'totalRefundedAmount' }, { label: 'cancellationCharges', fieldName: 'totCancellationCharges' }, ]; export default class ActivitiesFlow extends LightningElement { @track allActivitiesData; @wire(fetchActivities, { recdId: '$sfrecordId' }) wiredActivities({ error, data }) { if (data) { this.allActivitiesData = data.map( record => Object.assign( { "totalTicketvalue": record.apiResptotalTicketvalue, "totalRefundedAmount": record.apiResptotalRefundedAmount, "totCancellationCharges": record.apiResptotalTicketvalue-record.apiResptotalRefundedAmount },record ) ); } else if (error) { this.error = error; this.allActivitiesData = undefined; } } }
We might have heard about the Push topics, If not these are mainly used for generating the events basis on some criteria defined on the SOQL and all these events will be consumed by the all the subscribers of the topic.
Let's assume if you have created some functionality using the Push topics either on VisualForce or in #lightningwebcomponents. It's Working as expected whenever there is change in specified object record etc..As we know the easiest way to deploy the components from sandbox to sandbox/production by using the Change Sets. Some times we might end up use cases where change sets might not be supported and we are trying to deploying using the ANT, Workbench or Visual Code. In all these cases we might need the package.xml file is required either to retrieve the package or to deploy the package.
Preparing the package.xml file by adding the each component manually is little bit of hard .So, I want to try adding the all the list of components using the change set name because it's easy to add from the UI and with help of change set name I want to download the package.xml for further processing.
Is it really possible to download the package.xml file using the change set name 🤔? The simple answer is Yes ,we can do this by following the below steps .
1. Go to Setup ---> Search for Outbound Change Sets.
2. Click on New --> Enter Change set name and Description.
3. Add all the components you want to deploy.
4. Copy the Change set name as shown below.
5.Login to the Workbench with same sandbox where change set is created.
6. Click on the retrieve option under the Migration.
7. Enter the Change Set Name in Package Names text box and Check Single Package
8. Click Next and then on Retrieve button.
9. Once Retrieve result Zip file is ready just click on download zip file.
10.Extract the file inside that you can see the package.xml file.
We have couple of outbound messages linked under the workflow rules and all these outbound message will send some of custom objects data and standard objects data to external systems everytime any kind of DML operation happens on these objects.
Everything got set up and working as expected. But recently we have come across a situation where all the outbound messages are pushing data from sandboxes to same external systems assuming that we forgot to disable these workflow rules in sandbox before we activate it and somehow we missed to change the outbound messages end point from production to sandbox.
Because of all these things the sandbox data got messed up with the production data. So, we started exploring the options how can we stop all these Workflow rules automatically in sandbox or can we change the endpoint from production to stage automatically after refreshing the sandbox.
As a solution we come across multiple options but as a quick fix we have chosen to use the below solution.
1. Identify the environment like sandbox or production.
Salesforce Einstein Products
-----------------------------------------------------
As we know Salesforce has it's own artificial intelligence, natural language processing and deep learning technologies embedded product named it as "Einstein".
Some of this product features are already part of Salesforce clouds like sales cloud, service cloud and marketing cloud etc..
As a developer if you want to use these feature to build out of box features use it as well.
Some of the key products of einstein are listed below.
1. Einstein Bot
2. Einstein Next Best Action
3. Einstein Case Classification
4. Einstein Discovery
5. Einstein Prediction Builder
6. Einstein Language
7. Einstein Vision
Please use the below code snippet in you case you have getter and setter methods in your apex class and want to cover up the same lines in test class.
Main Class:
Public class SreeTestCase { public List<SelectOption> caseStatusList { get { List<SelectOption> options = new List<SelectOption>(); for( Schema.PicklistEntry f : Case.Status.getDescribe().getPicklistValues()) { options.add(new SelectOption(f.getValue(), f.getLabel())); } return options; } set; } }
Test Class:
@isTest private class SreeTestCaseTestClass { static testMethod void testStatusList() { SreeTestCase st = new SreeTestCase(); List<SelectOption> options = new List<SelectOption>(); options = st.caseStatusList; } }
Scenario:
So as a workaround we can have apex code snippet which can be used to perform the bulk deletion(in a single run max 200 records) of metadata .Please use the below code snippet for the same.
Source Code:
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
// Set the session id
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
//Add all your metadata records developer name to list
List<String> recordsToDelete = new List<String>();
For(YourMedataDataName__mdt m :[SELECT Developername from YourMedataDataName__mdt Limit 200])
{
String s = 'YourMedataDataName__mdt.'+m.Developername;
recordsToDelete.add(s);
}
//Perform the bulk deletion at a time max of 200 records
MetadataService.DeleteResult [] results = new MetadataService.DeleteResult []{};
results = service.deleteMetadata('CustomMetadata', recordsToDelete);
Scenario:
Let's assume we have group of users assigned under the omni channel for handling of incoming chat request.
How can we set the different maximum chat limit for user basis on experience. Ex For new joiner we want to setup of maximum cap as 5 and others as 7 chats.
Solution:
Ideally in omni channel the agent capacity and which Omni-channels features can be accessed like auto decline or auto accept of the work items can be performed using the "Presence Configuration" settings.
So in our case also we can create two presence configurations ,one for the new joiners and second for the others. Under the new joiners configuration we will add all the new joiners so when they logged into Omni channel the chat capacity will be picked up from here automatically.
If you're facing an issue with Aura:if isTrue while using the And Clause or OR clause we need to know the below points.
According to salesforce documentation And/Or clause only supports two arguments for evaluation.
If you're using more than 2 arguments in And/Or clause by default Salesforce ignores it.
<Aura:if IsTrue ="Or(expression 1,expression 2)"> - - This is valid.
<Aura:if IsTrue ="Or(expression 1,expression 2, expression 3)"> - - This will not work as expected because Salesforce ignores the expression 3 for evaluation.
Workaround :
If you need to solve this problem simply convert them into simple multiple chain expressions.
Aura:if IsTrue ="Or(expression 1,expression 2) || expression 3)">
Aura:if IsTrue ="Or(expression 1,expression 2) || Or(expression 3, expression 4)">
Trigger DailyTimeSheetTrigger On Daily_Time_Sheet__c(after insert) { List<Weekly_Time_Sheet__c> listWTSToUpsert = new List<Weekly_Time_Sheet__c>(); List<Daily_Time_Sheet__c> listDTSUpdate = new List<Daily_Time_Sheet__c >(); Map<String,id> mapHours = new Map<String,id>(); set<string> setUniqueParent = new set<string>(); for(Daily_Time_Sheet__c dts:Trigger.new) { if(dts.ChildUserIdWeekStrartDate__c!=null && dts.Weekly_Time_Sheet__c==null) { Weekly_Time_Sheet__c wts = new Weekly_Time_Sheet__c(); wts.Parent_User_Week_Start__c = dts.Chi; if(!setUniqueParent.contains(wts.Parent_User_Week_Start__c)) { listWTSToUpsert.add(wts); setUniqueParent.add(wts.Parent_User_Week_Start__c); } } } try { if(!listWTSToUpsert.isEmpty()) Database.UpsertResult[] wtsUpsertResult = Database.upsert(listWTSToUpsert,Weekly_Time_Sheet__c.Parent_User_Week_Start__c,false); for(Weekly_Time_Sheet__c ws:listWTSToUpsert) { mapHours.put(ws.Parent_User_Week_Start__c,ws.id); } for(Daily_Time_Sheet__c dts:[SeLEcT id ,ChildUserIdWeekStrartDate__c,Weekly_Time_Sheet__c FROM Daily_Time_Sheet__c WHERE ID IN: Trigger.new]) { if(dts.ChildUserIdWeekStrartDate__c!=null && dts.Weekly_Time_Sheet__c==null) { if(mapHours.containsKey(bh.ChildUserIdWeekStrartDate__c)) { bh.Weekly_Time_Sheet__c = mapHours.get(guid); listDTSUpdate.add(bh); } } } if(!listDTSUpdate.isEmpty()) Database.SaveResult[] wbhUpsertResult2 = Database.update(listDTSUpdate,false); } catch(exception e) { system.debug('exception ..'+e); } }