• RDSS
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 5
    Replies
Query records where lastmodifieddate should be between 01-08-2017 and 01-10-2017 and Createddate should not equal to LAstmodifieddate? Is it possible through SOQL? If not what can i do get this?

Thanks 
R
  • October 24, 2017
  • Like
  • 0
Hi All,

I want to add 5 days to today's date.
Example : Suppose i have a date field Collection_date__c which is having a date of 24th may 2017 and I am quering it today(19th May 2017). It should display this 24th Mau record.

Select Id, Collection_date__c from Custom_Object__c where Collection_date__c = today + 5;

Please Help

Thanks 
RD
  • May 19, 2017
  • Like
  • 0
Hi ,
In the below written code , Lst has nothing, hence recentLoanCycle variable is not getting initialized, but it is still entering the if statement where i am checking if string is null or blank.
Please help!!

list<Lead> lst = new list<Lead>();
lst = [select Id ,Status, Loan_Cycle__c, client__c from lead 
       where (Product_code__c = 891 OR product_code__c = 894 OR product_code__c = 915) 
       AND client__c = '0018A000008XOQ4'  order by createddate DESC LIMIT 1];
if(lst.size() > 0 && lst != null)
{
    string recentLoanCycle = lst[0].loan_cycle__c.substring(1,2);

}
if(recentLoanCycle != null && recentLoanCycle != '')
{
   system.debug('asdfsa' + recentLoanCycle); 
}
  • February 28, 2017
  • Like
  • 0
Hi,


I am comparing two fields but validation rule fires even if the fields are empty. I want to skip the condition when fields are empty. It should only compare when fields have values.

AND(  
    NOT(ISBLANK(Account__r.NomineeAddress1__c)),
(IF( Spouse_Name__c = Account__r.NomineeAddress1__c  , True, false)))

Thanks
Raman
  • December 26, 2016
  • Like
  • 0
Hi,
I have written a batch class for sending SMSs using SMS Magic.
Everything seems fine but it is failing while insertion.
Please help.
Below is the batch class.

Global class BatchSmsAfterSevenDaysOFDisburmentEFS implements Database.Batchable<sObject>
{
    Public date varDate = date.today();
    Public string str = 'Disbursed';
    list<smagicinteract__smsMagic__c> lstSmsMagic = new list<smagicinteract__smsMagic__c>();
    smagicinteract__smsMagic__c objSmsMagic = new smagicinteract__smsMagic__c();
    string Query = 'Select Id, Client_Name_EFS__c, Actual_Disbursement_date__c,(Select id, Account.phone, Account.Name from opportunities__r) from Application__c where Application_Status__c =\'' + str + '\'';
    global Database.QueryLocator start(Database.batchableContext bc)
    {
        system.debug('inside start');
        return database.getQueryLocator(Query);
    }
    
    global void execute(Database.batchableContext bc, list<Application__c> scope)
    {    
        system.debug('inside Execute start' + scope);
        for(Application__c ObjApplication : scope)
        {
            system.debug('@@@@@@@@@@@ inside application for loop');
            //objSmsMagic.smagicinteract__Name__c = ObjApplication.Client_Name_EFS__c;
            if(ObjApplication.Actual_Disbursement_date__c.daysbetween(varDate) == 7)
            {
                system.debug('@@@@@@@@ date checking');
                for(opportunity objOpp : ObjApplication.opportunities__r )
                {
                    system.debug('@@@@@@@@ inside opportunity for loop');
                      If(objOpp.Account.Phone.length() == 10 || objOpp.Account.Phone.isNumeric())
                      {
                        System.Debug('^^^^^Inside IFF^^^^^ ');
                        objSmsMagic.smagicinteract__Name__c = objOpp.Account.Name;
                        objSmsMagic.smagicinteract__PhoneNumber__c=objOpp.Account.Phone;
                        objSmsMagic.smagicinteract__SenderId__c='Transactional';
                        objSmsMagic.smagicinteract__external_field__c = smagicinteract.ApexAPI.generateUniqueKey();
                        objSmsMagic.smagicinteract__SMSText__c= LoanMessageBasedOnApplicationStatus.AfterSevenDaysofDisbursmentMessage;
                        lstSmsMagic.add(objSmsMagic);
                        system.debug('>>> >>> Inside for Second loop ' + lstSmsMagic);
                      }     
                }  
            }    
        }
        try
        {    
            if(lstSmsMagic.size()> 0)
            {
                system.debug('@@@@@@@@ before sending' + lstSmsMagic.size() + ' and  ' + lstSmsMagic);
                Database.insert(lstSmsMagic, false);
                system.debug('@@@@@@@@ after sending');
            }
        }
        catch(DmlException e)
        {
             system.debug('********++++++++++*******'+e.getMessage());            
        }
    }
    
    
    global void finish(Database.batchableContext bc)
    {
    }
}


 
  • December 17, 2016
  • Like
  • 0
Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details. Error ID: 969321508-14233 (357396811).

Above is the error i am getting when i am trying to activate the process in process builder.
Below is the screenshot of my process in process builder.

User-added image

I dont know what is wrong with it. Please Help.

Thanks
  • December 13, 2016
  • Like
  • 0
I am using SMS Magic for sending SMS. I am sending SMS when status is Submitted. Now i am stuck at where i need to send an SMS after 7 days from the date when the application was submitted. I have written a trigger to send SMS for submitted status. How it can be achieved? Please help.
  • December 12, 2016
  • Like
  • 0
global class Batch_ABC implements Database.Batchable<sObject>
{
    list<lead> lstLeads = new list<Lead>();
    global string CISNumber;
    public string str='closed';     
    string Query ='select name, CIS_No__c, Status__c from opportunity where PRODUCT_CODE_FORMULA__c IN (891, 894, 915) AND Status__c =\'' + str + '\'';
    
    global database.QueryLocator start(Database.batchableContext bc)
    {
        System.debug(Query);
        system.debug('inside start');
        

        return database.getQueryLocator(Query);
    }
    
    global void execute(database.batchableContext bc, list<Opportunity> scope)
    {
        system.debug('inside Execute start');
        for(Opportunity o : scope)
        {
        system.debug('inside For loop of execute');

             CISNumber = o.CIS_No_MP__c;
             system.debug('inside execute.. CIS No : ' + CISNumber );

        }
        
        for(Account a : [select name, (Select ID, Name from Leads__r where Status = 'Closed - Converted' AND Loan_Cycle__c = 'K1' AND Product_Code__c IN (891, 894, 915)) from account where CNumber =: CSNumber])
        {
        system.debug('Inside second loop of execute...');

             for(lead l : a.Leads__r)
             {
                 system.debug('inside nested loop of execute...');
                   lstLeads.add(l);
             }
        }
        system.debug('Leads' + lstLeads);
        delete lstLeads ;
    }
    
    global void finish(database.batchableContext bc)
    {
    
    }
}
  • October 21, 2016
  • Like
  • 0
Hi All,

I want to add 5 days to today's date.
Example : Suppose i have a date field Collection_date__c which is having a date of 24th may 2017 and I am quering it today(19th May 2017). It should display this 24th Mau record.

Select Id, Collection_date__c from Custom_Object__c where Collection_date__c = today + 5;

Please Help

Thanks 
RD
  • May 19, 2017
  • Like
  • 0
Hi ,
In the below written code , Lst has nothing, hence recentLoanCycle variable is not getting initialized, but it is still entering the if statement where i am checking if string is null or blank.
Please help!!

list<Lead> lst = new list<Lead>();
lst = [select Id ,Status, Loan_Cycle__c, client__c from lead 
       where (Product_code__c = 891 OR product_code__c = 894 OR product_code__c = 915) 
       AND client__c = '0018A000008XOQ4'  order by createddate DESC LIMIT 1];
if(lst.size() > 0 && lst != null)
{
    string recentLoanCycle = lst[0].loan_cycle__c.substring(1,2);

}
if(recentLoanCycle != null && recentLoanCycle != '')
{
   system.debug('asdfsa' + recentLoanCycle); 
}
  • February 28, 2017
  • Like
  • 0
Hi,
I have written a batch class for sending SMSs using SMS Magic.
Everything seems fine but it is failing while insertion.
Please help.
Below is the batch class.

Global class BatchSmsAfterSevenDaysOFDisburmentEFS implements Database.Batchable<sObject>
{
    Public date varDate = date.today();
    Public string str = 'Disbursed';
    list<smagicinteract__smsMagic__c> lstSmsMagic = new list<smagicinteract__smsMagic__c>();
    smagicinteract__smsMagic__c objSmsMagic = new smagicinteract__smsMagic__c();
    string Query = 'Select Id, Client_Name_EFS__c, Actual_Disbursement_date__c,(Select id, Account.phone, Account.Name from opportunities__r) from Application__c where Application_Status__c =\'' + str + '\'';
    global Database.QueryLocator start(Database.batchableContext bc)
    {
        system.debug('inside start');
        return database.getQueryLocator(Query);
    }
    
    global void execute(Database.batchableContext bc, list<Application__c> scope)
    {    
        system.debug('inside Execute start' + scope);
        for(Application__c ObjApplication : scope)
        {
            system.debug('@@@@@@@@@@@ inside application for loop');
            //objSmsMagic.smagicinteract__Name__c = ObjApplication.Client_Name_EFS__c;
            if(ObjApplication.Actual_Disbursement_date__c.daysbetween(varDate) == 7)
            {
                system.debug('@@@@@@@@ date checking');
                for(opportunity objOpp : ObjApplication.opportunities__r )
                {
                    system.debug('@@@@@@@@ inside opportunity for loop');
                      If(objOpp.Account.Phone.length() == 10 || objOpp.Account.Phone.isNumeric())
                      {
                        System.Debug('^^^^^Inside IFF^^^^^ ');
                        objSmsMagic.smagicinteract__Name__c = objOpp.Account.Name;
                        objSmsMagic.smagicinteract__PhoneNumber__c=objOpp.Account.Phone;
                        objSmsMagic.smagicinteract__SenderId__c='Transactional';
                        objSmsMagic.smagicinteract__external_field__c = smagicinteract.ApexAPI.generateUniqueKey();
                        objSmsMagic.smagicinteract__SMSText__c= LoanMessageBasedOnApplicationStatus.AfterSevenDaysofDisbursmentMessage;
                        lstSmsMagic.add(objSmsMagic);
                        system.debug('>>> >>> Inside for Second loop ' + lstSmsMagic);
                      }     
                }  
            }    
        }
        try
        {    
            if(lstSmsMagic.size()> 0)
            {
                system.debug('@@@@@@@@ before sending' + lstSmsMagic.size() + ' and  ' + lstSmsMagic);
                Database.insert(lstSmsMagic, false);
                system.debug('@@@@@@@@ after sending');
            }
        }
        catch(DmlException e)
        {
             system.debug('********++++++++++*******'+e.getMessage());            
        }
    }
    
    
    global void finish(Database.batchableContext bc)
    {
    }
}


 
  • December 17, 2016
  • Like
  • 0