• SUCHARITA MONDAL
  • SMARTIE
  • 554 Points
  • Member since 2015


  • Chatter
    Feed
  • 18
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 121
    Replies
I have a text field that I want to make available to users in a flow based upon what they select in a picklist. So if they select "Other" in the picklst, a text field called "Details will appear for them to fill out.

I have done as the documentatiuon suggests. The field is not visible when the user executes the flow. But when they select "OPther" the field should then become visible but it does not.

Any thoughts or suggestions?
Steve
Hello everyone. I created a flow today using the flow builder flowId=30129000000ULTsAAO and added the flow to the lightning page layout. My question is there a way to instead of adding the flow to the page layout could you add a button to the page layout instead to execute the flow see the image I am gathering two pieces of information
User-added image 
Happy New Year everyone.
Need some assistance with my class.  Trying to get the SOQL queries outside the for loop if possible.  But in teh query I am using the Id as a filter.  Any thoughts? 
if( Trigger.isInsert ){
            List<Id> docIds = new List<Id>();
            List<String> parentIds = new List<String>();

            for( Attachment__c record : ( List<Attachment__c> ) Trigger.new ){
                Id docId = record.ContentDocumentId__c;
                    parentId = record.Parent_ID__c ;
                    Id recId = Id.valueOf(record.Parent_ID__c ); 
                    String parentObjectType = String.valueOf( recId.getSObjectType());
                        if( parentObjectType == 'Activity__c' ){
                           list<Activity__c> actparentId = [Select id,Project__r.Cust__c  from Activity__c WHERE Id =: parentId];   
                           for(Activity__c act :actparentId){
                                parentId = act.Project__r.Cust__c;
                            }
                        }
                        
                        if( parentObjectType == 'Project__c' ){
                           list<Project__c> projparentId = [Select Cust__c from Project__c WHERE Id =: parentId];   
                           for(Project__c proj :projparentId){
                                parentId = proj.Cust__c;
                            }
                        }
                        
                        if( docId != null ){    
                            docIds.add( docId );
                        }
            }

            List<ContentDocumentLink> linkList = [ SELECT Id, ContentDocumentId, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN: docIds ];
            if( !linkList.isEmpty() ){
                for( ContentDocumentLink link : linkList ){
                    List<ContentDocumentLink> links = this.linkMap.containsKey( link.ContentDocumentId )
                        ? this.linkMap.get( link.ContentDocumentId ) : new List<ContentDocumentLink>();
                    links.add( link );
                    this.linkMap.put( link.ContentDocumentId, links );
                }
            }
        
        }

 
can any one explain what is programming elements and how data abstraction can be imlemented in salesforce explain with the example?
Any user scenarios for data abstraction?

here apex code 
global with sharing class schedularCloseAllDealsMonthAgo implements Schedulable{
      global void execute(SchedulableContext sc) {  
            closeAllDealsMonthAgo closeDeals = new closeAllDealsMonthAgo(); 
            database.executebatch(closeDeals);
      }
      public static void schedulerMethod(){
            schedularCloseAllDealsMonthAgo sched = new schedularCloseAllDealsMonthAgo();
            string con_exp= '0 0 10 * * ?';
            System.schedule('schedularCloseAllDealsMonthAgo', con_exp, sched);
      }
}
This is code of test but not work for 100%
@isTest   
public class schedularCloseAllDealsMonthAgoTest {
    public static testMethod void testschedule() {
        Test.StartTest();
            schedularCloseAllDealsMonthAgo sched = new schedularCloseAllDealsMonthAgo();
            String CRON_EXP = '0 0 23 * * ?';
            System.schedule('schedularCloseAllDealsMonthAgo', CRON_EXP, sched);
        Test.stopTest();
    }
}
Hi All,

Im writing a test class for batch apex that will be scheduled to run on the first of each month.  Were testing it here, but i keep running into this error at line 25 "System.QueryException: List has no rows for assignment to SObject".  I dont know why that list would be blank.  Can anyone advise? thanks/
 
public class TouchSalesDatasTest {
	@isTest
    public static void Test() {
        Map<ID,Sales_Data__c> SDMap = new Map<ID,Sales_Data__c>();
        Account Acc = TestDataFactory.createAccount('TouchSalesDataTest EU ', 'desiredrecordtypeid', null, null, true);
        Account Dist = TestDataFactory.createAccount('TouchSalesDataTest Dist ', 'desiredrecordtypeid', null, null, true);
        for (Integer i = 0; i < 200; i++) {
            Sales_Data__c SD = new Sales_Data__c(End_User__c = Acc.ID,
                                                 Distributor__c = Dist.Id,
                                                 Amount__c = i,
                                                 Quantity__c = i,
                                                 Date__c = System.today().addDays(-25),
                                                 Product__c = 'desiredproductid');
            SDMap.put(SD.Id,SD);
        }
        insert SDMap.values();
        
        Decimal expectedValue = System.today().addDays(-25).daysBetween(System.today())/31;
        
        Test.startTest();
        TouchSalesDatas t = new TouchSalesDatas();
        Database.executeBatch(t);
        Test.stopTest();
        
        Sales_Data__c UpdatedTest = [SELECT ID,Name,Months_Ago__c FROM Sales_Data__c WHERE ID IN :SDMap.keySet() Limit 1];
        System.assertEquals(Math.round(expectedValue), UpdatedTest.Months_Ago__c);
    }
}

 
I entered a contact in the Name and Attendees field and now I want to be able to make sure that if I deleted a Contact from the name field it gets removed from the Invitees field and vise versa. To make this happen, I did an IF statement to check if the value of isParent == false OR isInvitee == false. This works for the isParent == false, but it doesn't seem to catch it if the isInvitee == false. Can anyone help me on why 'OR' is not working and have any suggestions on how to make this work? Thanks.

if (trigger.isUpdate){ List<EventRelation> erLst = [SELECT EventId, RelationId, isParent, isInvitee FROM EventRelation where EventId IN :sEvents ]; for(EventRelation sObj: erLst ){ if (sObj.IsParent == false || sObj.IsInvitee == false ){ delete sObj; } else{ sObj.IsParent = true; sObj.IsInvitee = true; UpdatedLst.add(sObj); update UpdatedLst; } } }
  • May 09, 2020
  • Like
  • 0
Hi all - we don't use accounts in my installation, yet the reports all need an Account or the Contacts don't show up.

It is easy enough to update all existing contacts with AcctID=Individual, but how can I set it up so any new Contact has default of Individual account?

Please don't say "make Account required field and make them pick Individual".. I want it to default.

Thank you!
Hello, we have a trigger on Lead that creates a Contact based on 2 fields from the Lead . After the Contact is inserted, we want to turn the Lead field that contains the name of the Contact to turn into a hyperlink with a link to that Contact record. I built a trigger, but it is not working, and I am not sure why not. Can someone please help. Here is the trigger:

trigger ContactsTrigger on Contact (after insert) {
     // add mobilephone to set and assign id variable
    Set<String> contactNumSet = new Set<String>();
    Id newConId;
    for (contact c : trigger.new){
        if (c.mobilephone != null){
            newConId = c.id;
            contactNumSet.add(c.mobilephone);
        }
    }
 //query related lead   
 List<Lead> refsToInvestigate = new List<Lead>();       
 List<Lead> refsToUpdate = new List<Lead>();  
 String nok1;
    refsToInvestigate = [select emergency_contact_phone__c from Lead where emergency_contact_phone__c = :contactNumSet];    
        for (Lead ref : refsToInvestigate){
                nok1 = ref.NextofKin__c; }
    
    for (Lead refer : refsToInvestigate){
                refer.nextofkin__c =  '<a href=https://centers--partial.lightning.force.com/'+newConId+'>'+nok1+ '</a>' ;
        refsToUpdate.add(refer);  } 
         update refsToUpdate;

}
global class AgeUpdate implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext bc)

    {

    return Database.getQueryLocator([SELECT dateOfBirth__c,Id,Status FROM Lead WHERE Status = 'Unqualified' AND dateOfBirth__c = TODAY]);

   }

     global void execute(Database.BatchableContext bc, List<Lead> scope)

   {

      for(Lead l: scope)

        {

            l.Age__c = l.Current_Age__c;

        }

            update scope;
       
    }
    
     global void finish(Database.BatchableContext bc)
     {}

}
 
public List<Account> acclist = new List<Account>();
for(integer i =0; i<10; i++){
    Account acc = new Account();
    acc.name='Account'+i;
    acc.Industry = 'Agriculture';
    acclist.add(acc);
}
Database.SaveResult[] sr= database.insert(acc,false);
for(database.SaveResult srtest : sr){
    if(srtest.isSuccess()){
        system.debug('success');
    }
    else{
        for(database.error e : srtest.getErrors()){
            system.debug('**** '+e.getMessage());
        }
    }
}


I am getting -
variable doesnt exist : acc
error while executing this in anonymous window.
Hello,

I have created an apex class to count the number of textpost in a case but my code doesn't not iterate...
Could someone help?
Thanks
public class FeedItemTriggerHandler {
    public static void countFeedItem(List<FeedItem> lstFeed){ 
        set<id> relatedCasesIds = new set<id>();
        for(FeedItem fd : lstFeed) {
            if (fd.type =='TextPost')relatedCasesIds.add(fd.ParentId);
        }
        Map<Id, case> relatedCases = new Map<Id, case> ([Select id, caseNumber,All_Users_Feed_Count__c FROM case where id in: relatedCasesIds]);
       	List<case> casesToUpdate = new List<case>(); 
        
        integer count = 0;
        for(case c:relatedCases.values()) {
           for(FeedItem fd : lstFeed) {
               if (fd.type =='TextPost' && fd.Visibility =='AllUsers' && fd.ParentId == c.id) {
                   count+=1;
                   
               } 
       		 } 
            c.All_Users_Feed_Count__c = count;
            count = 0;
            casesToUpdate.add(c);
              
        }
        if(casesToUpdate.size() > 0) update casesToUpdate; 
    }
}

 
Hi guys,

I've created a custom screen flow and I want to add it to a community page, launched from a custom button on the Homepage. 
The flow guides users through creating a case. I am getting the following error when I add the component to the page: "Action failed: c:CustomCaseCommunityComponent$controller$init [flowData is not defined]"

This is my component. 

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,forceCommunity:availableForAllPageTypes,force:hasRecordId,force:lightningQuickActionWithoutHeader" access="global">

    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <lightning:flow aura:id="flowData"/>
    
</aura:component>


({
init : function (component) {
var flow = component.find(flowData);
flow.startFlow(CaseFlow);
},
})
Hello All,

I am trying to write a trigger to update a parent object field when its child record is added/updated. I am quite new to Salesforce Apex and tried to read a few posts in the forum and still could not get it working. Any thoughts on this is appreciated. Thank you!

Example:
Parent Object: Sales_Event__c
Field to update: Cost_Item_Update__c
Child Object: Sales_Event_Cost_Item__c (Master-Detail(Sales Event))
Sales_Event_ID__c = Sales_Event__r.Id (I’m not too sure if there is proper way to get Sales_Event ID in Sales_Event_Cost_Item__c so I create a new formula field here which I think may not be necessary though..)
Fields to be CONCATENATED: Cost_Items__c and  Quantity__c
So I would like to get below in my Parent Object:
e.g. Sales Event A has 2 Cost items,
Cost_Item_Update__c = “Cost_Item one (Quantity__c), Cost_Item two (Quantity__c)”
But my Cost_Item_Update__c  even can’t get the Cost_Items__c (Cost_Item one, Cost_Item two iteration) right.. I am wondering if I map the objects incorrectly...
trigger TestSalesEventCostItemUpdate on Sales_Event_Cost_Item__c (after insert, after delete, after update) {

    list<id> parentIDstoUpdate = new list<id>();
    if(Trigger.isInsert||Trigger.isAfter||Trigger.isDelete ){
            for (Sales_Event_Cost_Item__c co : Trigger.new) {
                parentIDstoUpdate.add(co.Sales_Event__c);       
            } 
    }

    map<id,string>  mapParentIdtoString = new Map<ID,String>();
    string str;

    for (Sales_Event_Cost_Item__c co: [SELECT Sales_Event_ID__c, Cost_Items__c from Sales_Event_Cost_Item__c WHERE Sales_Event_ID__c =:parentIDstoUpdate ]){
        if(mapParentIdtoString.containsKey(co.Sales_Event_ID__c)){
            str = mapParentIdtoString.get(co.Sales_Event_ID__c);
            str = str + ';' + co.Cost_Items__c;  
            mapParentIdtoString.put(co.Sales_Event_ID__c,str);
        }else{
            mapParentIdtoString.put(co.Sales_Event_ID__c,co.Cost_Items__c);
        }
    }
    
    list<Sales_Event__c> recordstoUpdate = new list<Sales_Event__c>();
    for (Sales_Event__c p: [SELECT ID, Cost_Item_Update__c FROM Sales_Event__c WHERE id =:recordstoUpdate ]){ 
        p.Cost_Item_Update__c = mapParentIdtoString.get(p.id);
        recordstoUpdate.add(p);
    }

    if (recordstoUpdate != null && recordstoUpdate.size()>0){
        update recordstoUpdate;
    }
}
Good morning all. I have a trigger that creates new records related to opportunities.

I have everything working but my loop and i am stuck. I am very new to coding and would really appreciate some assistance.

This iwhat I have so far and everything works...except....
                            //while loop create record process                     	
              				decimal counter = 0;
              				while (counter < opportunityList.Quarters_Spanned_op__c)
                			{
                                
                			Open_Quarter__c oq           = new Open_Quarter__C();
                			Quarter_Number__c qn		 = new Quarter_Number__c();
                			oq.Amount_Per_Quarter_oq__c  = opportunityList.Amount_per_Quarter_op__c;
                			oq.Close_Date_oq__c          = opportunityList.CloseDate;
                			oq.Name            			 = opportunityList.Quarter_Created_op__c;
                			oq.Opportunity_Name_oq__c    = opportunityList.Id;
                			oq.Quarters_Spanned_oq__c    = opportunityList.Quarters_Spanned_op__c;

							createOpenQuarter.add(oq);
                			counter++;
          					
                            }//end while loop                                             
When I create each new record I need it to populate a field in that record with escalating quarter names. Right now it creates the right nimber of records but they all have the same quarter name in them which the starting quarter of the opp.

Now I have four custom formula fields in the opp that I can use.
  • One with the name for the quarter when the opp was created in this format: 2019-Q1 etc
  • One with the year the opp was started as a number "2019"
  • One with the starting quarter as a number (1-4)
  • One with the number of quarters the opp spanse based upon the created and close dates also expressed as a number.
I was told that I can loop the quarters within the year so that if an opp ovewrlaps years i can increment the rear number and reset the quarter to one and continue the loop for the same number of times as the quarters spanned (I already have that part)

But the rest is all very new to me. How do I build these nested loops with an output for each iteration that looks like this "2019-Q1" that I can use in creating my new records.

I am really stuck here so any help at all will be greatly appreciated.
Best regards,
Steve
 
Hi All.  Long Time admin but Very new to apex and developing.  I have a child object for accounts "sales data" which essentially is just transactional line items of purchases (related to the distributor, and the account).  So now I want to have a trigger on the sales data object that takes the sum of the amt in last 45 days by account then by distributor.  So that i can update the primary & secondary relationship on the account to indicate the distributor that is doing the most and second most sales for that account respectively.  below is what i have so far.  Please take a look and help out with getting thsi to run, and also how do i bulkify this??  Thanks guys!
 
trigger DistributorIDs on Sales_data__c (after insert, after update) {
       Date AfterDate = Date.today().addDays(-45);
       List <Account> AccountsList = new List<Account>();
    For (Sales_data__c Sd: Trigger.new) {
        AccountsList.add(Sd.End_user__r);
    } 
       Set<Account> DeDupSet = new Set<Account>();
       List<Account> DeDupAccounts = new List<Account>();
       DeDupSet.addAll(AccountsList);
       DeDupAccounts.addAll(DeDupSet);
    For (Account Acc: DeDupAccounts) {
        List<AggregateResult> Distributors = [SELECT Distributor__c, SUM(Amount__c) FROM Sales_Data__c 
                                    WHERE Date__c >= :AfterDate AND End_user__c = :Acc.Id
                                    GROUP BY Distributor__c ORDER BY SUM(Amount__c) LIMIT 2];
        ID FirstPosition = (ID)Distributors[0].get('expr0');
        ID SecondPosition = (ID)Distributors[1].get('expr1');
        Acc.Acct_Primary_Distributor__c = FirstPosition;
        Acc.Acct_Secondary_Distributor__c = SecondPosition;
    }
    update DeDupAccounts;
}

 
Hi everybody,

I am trying to access subquery field which is in a list.
ex: List<Account> newList = new List<Account>([Select Name,phone,(Select name,phone from Contacts)  from Account]);
In the above code the values can be accessed for account by using "newList.Name". But when i try to access contacts of that account i.e.(newList.Contacts.name).It is giving me error.

So,is there any way to access the subquery(Contacts) field values.

Thanks.
I have a trigger that creates records related the opportunity that fires the trigger.

I need to add a step that will delete any of these existing records if the close date is updated.

Each opp will have one or more of these related records.

How do i identify / list these records and delete them?

I think I have my conditionals all set up the way I need them. i just need to identify them and delete them.

Any suggestions out there?
Steve

Hi All,
Did anyone faced such error as below:

INVALID_TYPE: sObject type 'CaseComment' is not supported in describeCompactLayouts.

I'm getting above error in Lightning, while clicking on Case comment on Case record.

P.S. Any help/direction is appreciated.

Thanks,
Sucharita

 

here is the controller code..

({
    doClose : function(component, event, helper) {
        var recid = component.get("v.recordId");
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": "/"+recid
        });
        urlEvent.fire();
        
    },
    handleSubmit : function(component, event, helper) {
        component.find("recordEditForm").submit();
        
        var payload = event.getParams().response;
        debugger;
        console.log(payload.id);
    }
})

Hey..

We want to track the email and links that how many time email is opened and links are clicked and that to by using tracking pixel.
Could anybody help that how can we create tracking pixel in Salesforce it is as same as salesforce embeds when email is fired using email templates and tracks are updated which can be shown at HTML Email Status related list.

Thanks..

Hi,
<lightning:progressBar value="50" size="large" />

Want to get green color for the above progress bar.

Thanks.
Package Version creation is failing is SDFX CLI.
 How would I add this currency as part of the test data in test class?

My understanding is , as part of package creation salesforce creates an empty scratch org and deploy the metadata and finally run the test classes. By default only 'USD' is available in empty scratch org. The above test method is failing since "EUR" currency is not available.

Test class uses code which has 
demoNewquote.CurrencyIsoCode = 'EUR';
Hi All,

I have a text field and would like to add a validation rule so users can only enter a certain set of characters in it. But my validation rule is failing with Syntax error here. Can someone help?

REGEX(field ,
"([a-zA-Z0-9 .?!,;:_@&/\'"`~()<>$#%])*")

Basically, it should allow alphanumeric characters including spaces AND any of the special characters that are listed here "Period
Question Mark
Exclamation Point
Comma
Semi-colon
Colon
Underscore
At Sign
Ampersand
Forward Slash
Back Slash
Apostrophe
Quote
Grave Accent
Tilde
Left Parenthesis
Right Parenthesis
Less Than
Greater Than
Dollar Sign
Pound/Number
Percent".

Regards
Amar
I have a text field that I want to make available to users in a flow based upon what they select in a picklist. So if they select "Other" in the picklst, a text field called "Details will appear for them to fill out.

I have done as the documentatiuon suggests. The field is not visible when the user executes the flow. But when they select "OPther" the field should then become visible but it does not.

Any thoughts or suggestions?
Steve
I have a flow that is automating the milestone completion when an email or call is logged. I am getting an iterations error with a loop within the flow. I know the error is cause by the count exceeding the 2000 number that is set within service cloud. The flow is supposed to search the contacts on the TO: or CC: line within an email to check and verify a contact within the case or association is linked within the reply and if so mark the milestone as complete. However, with this error it seems that it is looping through all of the contacts and erroring out. Any help regarding this would be appreciated. 
Hello, I am having trouble finding a way to pull aggregate data from the below Apex class that I have for a component being built. We need to record the count of Id's and Total units from the child record ChildAccounts. I am relatively new to coding and so any information and help would be greatly appreciated!
 
public with sharing class GetAccountContactData {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountData() {
        return [SELECT Id, Name, 
        (SELECT Id, Name, Email, Phone, Title FROM Contacts), 
        (SELECT Id, Name, Region_picklist__c, Total_Units__c FROM ChildAccounts) 
        FROM Account WHERE Active__c = TRUE AND RecordTypeId = '0122K000001Dio1QAC' ORDER BY Name];
    }
}

 
Hi there,
Please help me to cover only 3 %, my test class covering 72% only, Attaching the screenshot with the red part which needs to cover.
Please guys help me.
Thanks
User-added imageUser-added imageUser-added image
Hi Everyone,
 My team have a requirements regarding API call, 
We have a pass HttpRequest in the form of JSON data.While, requesting to web service need data field validations like remove null and empty data, required fields should be filled or else throw an error in record page.  And, get back HttpResponse as JSON form.Once, get Reponse from web service need to handling the server response if response.GetStatusCode == 200 'success' or else need to stop the process and throw an error on the record page.

What I have done?
 Trigger to get Record when it's generate JSON data and validate. And, send that JSON data as a setBody while  sending  HttpRequest. Once the response get from web service, need a help to handling web service response.

Any Suggestions?
 Thanks in advance.
Hi Experts,
I am finding a solution of How to refresh lwc when any change is occurred in apex. In Lwc Component I am showing Contact records and I want to auto refresh when any changes is occurred in Apex.
I have no any apex class linked by lwc. my Lwc is inDepandent.
when I click a button at that time my Cmp is refreshing and getting new records but When any update is occurred in apex (LIke Via Trigger or user doing query and manually  update records in apex) at that time my Lwc automatic get refresh.

I hope someone will help me.
I will be greatfull.
Thanks In Advance
switch on m {
                    when 1 {        
                        invoiceDate__c = 'Jan 1 to Jan 31';
                    }    
                    when 2 {        
                        invoiceDate__c = 'Feb 1 to Feb 28';
                    }
                    when 3 {
                        invoiceDate__c = 'Mar 1 to Mar 31';
                    }
                    when 4 {          
                        invoiceDate__c = 'Apr 1 to Apr 30';
                    }
                     when 5 {        
                        invoiceDate__c = 'May 1 to May 31';
                    }    
                    when 6 {        
                        invoiceDate__c = 'Jun 1 to Jun 30';
                    }
                    when 7 {
                        invoiceDate__c = 'Jul 1 to Jul 31';
                    }
                    when 8 {          
                        invoiceDate__c = 'Aug 1 to Aug 31';
                    }
                    when 9 {        
                        invoiceDate__c = 'Sep 1 to Sep 30';
                    }    
                    when 10 {        
                        invoiceDate__c = 'Oct 1 to Oct 31';
                    }
                    when 11 {
                        invoiceDate__c = 'Nov 1 to Nov 30';
                    }
                    when 12 {          
                        invoiceDate__c = 'Dec 1 to Dec 31';
                    }
                }
  • August 05, 2021
  • Like
  • 0
Hi All,
I am trying to pass values to parent component using event in LWC.
But I am not able to retrieve the fields and use in a SOQL query.
I am getting [Object,Object] as field value.
I am trying to to do JSON.stringify() also.It is showing this
{FieldApiName:{Guest_Hotel_City__c},ObjectApiName:{Guest_Master}}
I need value of that field Guest_Hotel_City__c to make use of it in SOQL query.
Please help!!
Thanks in Advance.
JS code:
import { LightningElement } from 'lwc';
export default class HotelListingComponent extends LightningElement {
    handlechildevent(event){
    const varcityofhotel=event.detail.cityofhotel;
    const varpreferredhoteltype=event.detail.preferredhoteltype;
    var myjson=JSON.stringify(varcityofhotel);
    console.log("value after stringifying:",myjson);
        
        alert('Event handled in Parent Comp');
        alert('Guest Hotel City is: '+varcityofhotel);
        alert('Guest Hotel Type is: '+varpreferredhoteltype);
    }
}
  • August 03, 2021
  • Like
  • 0
hi guys, 
i have a question plz:
How can i get a reference to a custom label dynamically using lwc:
i have this code and i want to convert it to lwc:
var currentCat = categoryWrapper.categories[i];  var labelReference = $A.getReference("$Label.c."+currentCat.name);   component.set("v.tempLabel", labelReference);
//we can't use $A.getreference in lwc,
 and using apex i didn't found a solution 
this is the function in apex:
 @AuraEnabled     public static String getLabel(String LabelName){                  system.debug('LabelName'+LabelName);  
      String s2 = system.Label.LabelName ;  return s2;     }
this is the function in lwc:
 getLabel({
                    LabelName:labelReference, //labelreference is the name of custom label
                }).then(result=>{
                    
                    console.log('myJSON:'+result);
 
                }).catch(error=>{
                    console.log('error');
                })
//i want to return the value of a custom label when i send the name of custom label in parameter. Where Is my error, and is there a solution ?
Best Regards
Hi Team,

1.How to filter Long Text area in SOQL query?

2. How to refer Quote(child Obj) associated Account(Parent Obj) fields in email template (Merge fields),becuase 
 i tried like below
{!Quote.Account.LeadSouce} here LeadSouce is not displaying in email template.

Thanks
KMK

 
  • July 30, 2021
  • Like
  • 0
List1<account>: ({Name=Acc1, type__c=Marketing,Agree__c=no},{Name=Acc2, type__c=Sales,Agree__c=yes})
List2<account>: ({Name=Acc1, Sla__c=new},{Name=Acc2, Sla__c=pending})
I need to compare list1's name == list2's name and then concatenate/merge two lists into 1 record.
List3<account>: ({Name=Acc1, type__c=Marketing,Agree__c=no,Sla__c=new},{Name=Acc2, type__c=Sales,Agree__c=yes,Sla__c=pending})
Please let me know if it is possible.
Hi,
This is my first time using the @future annotation and was wondering if I could get some guidance.
I have a trigger on the contact, which is handled by a handler class. When a contact is deleted, I need to perfom a call out, so within the handler class I need to call a future method to perform that call out. As a future method only takes primitive data types, I have created another method which passes just the IDs to the future method. Is this the correct way to do this, or is there a better way?
I'm also a little concerned what happens if a mass delete is performed. How do you bulkify call outs?

Trigger:
trigger ContactTrigger on Contact (before delete, before insert, before update, after delete, after insert, after update) 
{
    ContactTriggerHandler handler = new ContactTriggerHandler(Trigger.isExecuting, Trigger.size);
    
    if (Trigger.isInsert && Trigger.isBefore)
    {
        handler.OnBeforeInsert(Trigger.new);       
    }
    else if (Trigger.isInsert && Trigger.isAfter)
    {
        handler.OnAfterInsert(Trigger.new, Trigger.newMap);
    }
    else if (Trigger.isUpdate && Trigger.isBefore)
    {
        handler.OnBeforeUpdate(Trigger.old, Trigger.oldmap, Trigger.new, Trigger.newmap);
    }
    else if (Trigger.isUpdate && Trigger.isAfter)
    {
        handler.OnAfterUpdate(Trigger.old, Trigger.oldmap, Trigger.new, Trigger.newmap);
    }
    else if(Trigger.isDelete && Trigger.isBefore)
    {
        handler.onBeforeDelete(trigger.old, trigger.oldMap);
    }
    else if(Trigger.isDelete && Trigger.isAfter)
    {
        handler.onAfterDelete(trigger.old, trigger.oldMap);
    }
}

Trigger handler class:
public class ContactTriggerHandler extends BaseTriggerHandler
{
    public ContactTriggerHandler(boolean isExecuting, integer size)
    {
        super(isExecuting, size);
    }
    
    public void OnBeforeInsert(Contact[] newContacts) 
    {}     
    
    public void OnAfterInsert(Contact[] newContacts, Map<ID, Contact> newContactsMap) 
    {}
    
    public void OnBeforeUpdate(Contact[] oldContacts, Map<ID, Contact> oldContactsMap, Contact[] updatedContacts, Map<ID, Contact> updatedContactsMap)
    {}
    
    public void OnAfterUpdate(Contact[] oldContacts, Map<ID, Contact> oldContactsMap, 
                              Contact[] updatedContacts, Map<ID, Contact> updatedContactsMap)
    {}
    
    public void OnBeforeDelete(Contact[] oldContacts, Map<ID, Contact> oldContactsMap)
    {}
    
    public void OnAfterDelete(Contact[] oldContacts, Map<ID, Contact> oldContactsMap)
    {
        passIDsToCallOut(oldContactsMap);
    }

    Private void passIDsToCallOut(Map<ID, Contact> contactsMap)
    {
        Set<Id> conIds = contactsMap.keySet();
        system.debug('con Ids for forget request');
        system.debug(conIds);
        sendForgetRequestGDPR(conIds);
    }
    
    @future(callout=true)
    Public static void sendForgetRequestGDPR(Set<id> contactIds)
    {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://****.com/api/auth/v1/login?email=myemail@email.co.uk&password=myPassword');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/x-www-form-urlencoded');
        request.setHeader('Accept', 'application/json');
        HttpResponse authResponse = http.send(request);
        if (authResponse.getStatusCode() == 200) {
            system.debug('got auth!');
            // Deserialize the JSON string into collections of primitive data types.
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(authResponse.getBody());
            List<Object> myresults = new List<Object>();
            for(Object obj : results.values())
            {
                myresults.add(obj);
            }
            string sessionId = string.ValueOf(myresults[0]);
            system.debug('session Id = ' +sessionId);
            request = new HttpRequest();
            request.setEndpoint('https://*****.com/api/v1/services/*****/gdpr/forget');
            request.setMethod('POST');
            request.setHeader('Content-Type','application/x-www-form-urlencoded');
            request.setHeader('Accept','application/json');
            request.setHeader('X-SESSION-ID',sessionId); 
            string comment = 'API Call';
            string contactId;
            for(Id conId : contactIds)
            {
                contactId = conId;
                request.setBody('record_id='+contactId+'&table_name=Contact&comment=' + EncodingUtil.urlEncode(comment, 'UTF-8'));
                system.debug(request);
                HttpResponse forgetResponse = http.send(request);
                if(forgetResponse.getStatusCode() == 200)
                {
                    system.debug('got GDPR!');
                }
                else
                {
                    system.debug('Forget Broken =' + forgetResponse.getStatusCode());
                }           
            }       
        }
        else
        {
            system.debug('Auth Broken =' + authResponse.getStatusCode());
        } 
    }
}

Many thanks
 
Hello,

We have some custom code that is used to create a case that works on standard apps but breaks when it is used with an app that has a Console view.

When attempting to save our record from this custom window, an error appears:

'No access to field ws. Either the field was removed from the entity or access to this field was removed.'

'ws' is not a field on our object, and I think that error message is just the result of bad URL parsing. 

We have an Apex function RequestAccount() that generates the URL, and this URL needs to be updated to work with Lightning Console apps, but we are having difficulty finding the instructions on how to do so for our case.

This is the current way we currently prepend the URL string:

String urlString = '/one/one.app#/n/RecordCreatePage?';

According to this article (https://help.salesforce.com/articleView?id=release-notes.rn_general_new_url_format_lex.htm&type=5&release=214) the one.app segment needs to be adjusted to something with "lightning", but for our particular case the syntax is not clear.

Can anyone provide assistance on the change we need to make to fix this operation on console apps?

Thanks
Chris Minotti