• Robert A. Elias
  • -1 Points
  • Member since 2022

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 5

We want to use SOQL to get all Leads whose status changed from A to B in a time window. My original idea is query LeadHistory and filter by OldValue and NewValue.
select fields(standard),Lead.Id, Lead.something from LeadHistory where Field='Status' and OldValue='Working - Contacted' and NewValue='Closed - Converted'
And then the query failed and I realized that OldValue and NewValue are not filterable.

The only workaround I can figure it out is to only condition on Field and use our downstream tasks to filter OldValue and NewValue.
select fields(standard),Lead.Id, Lead.something from LeadHistory where Field='Status'
But if a Lead changes status a couple times in the time window, the downstream tasks will see the same Lead multiple times. And it adds more burden on us to generalize the solution to more objects (such as Oppurtunity vs. OppurtunityFieldHistory).

I wonder if there is an eaiser way to get all Leads whose status just changed from A to B through SOQL?

Thank you!

I have a situation where I have two objects Opportunity and a custom Object Contract__c. In both the object I have a field called reference_name__c. Now the situation is that I have to query the objects and return the reference_name__c values. If Opportunity has reference_name__c value and Contract__c don't have reference_name__c value return value. If Opportunity has no reference_name__c value and Contract__c has reference_name__c value then return the value. How could I write the query? The query was written by me just satisfies the 1st condition. Please help me with the query.

Select Id, reference_name__c,(Select ID, reference_name__c from Contract__r where reference_name__c !=null Limit 10) from opportunity where AccountId != null AND reference_name__c != null AND Owner.AccountId =loggedInUser.Contact.AccountId limit 10

As per current implementation, my Case Detailed page is pure custom and I have Entitlement Processes and Milestones in place. The thing is that I cant access the Milestone Status Icon field, but I can access the MilestoneStatus value. That value I need to populate into Custom Milestone Status Icon and using formula field I wants to show the Milestone Status Icon.
I got the reference here : https://help.salesforce.com/articleView?id=000171150&language=en_US&type=1

How can I approach to this implementation ?
  • May 04, 2022
  • Like
  • 0
Hi All,
I am new to Salesforce .
I have configured Email-to-Case in my org.its working fine but
when i used to send a mail to my configured mail-id a case  record is getting created. 

when i am sending second mail i didn't want to create case record with my second mail.

Simply i want to attached the mail to my previous record.

I have written below code:
trigger UpdateCaseTrigger on Case (before insert) {
    if( Trigger.isBefore){
        List<Case> cs1=[select id,Status,SuppliedEmail,Subject,Description,Origin from Case];
        List<EmailMessage> em1=new List<EmailMessage>();
        for(case cs:Trigger.New){
            for(case cs2:cs1){
                if(cs.SuppliedEmail==cs2.SuppliedEmail && cs2.Status=='New'){
                   EmailMessage em=new EmailMessage();
        insert em1;

what can i do , please suggest any Solution.
Hi,this function takes as input a value (Quantity) this value must be subtracted from the value of the Available Quantity field contained in the "prodList" list filtered by the id, with the result of the subtraction "rquantity" must be inserted (update) in the list " v.prodList "passing the id. How can it be done?

yesBtn : function(component,event,helper){
        var qty=component.find("prova").get("v.value");
        var name=component.get("v.Name");
        var cr=component.get("v.id");
        var aquantity=component.get("v.AQuantity");
        console.log("id book "+component.get("v.id"));
            var toastEvent = $A.get("e.force:showToast");
                title : 'Error',
                message: 'the quantity you want exceeds that available',
                duration:' 5000',
                key: 'info_alt',
                type: 'Error',
                mode: 'pester'
            var rquantity=aquantity-qty;
            console.log("Available quantity - quantity = " +rquantity);