• Hari.gs
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 17
    Replies

 

Hi All,

 

Please tell me, how can i use Apex Data Loader to load some values into a custom field in the Account Object. It is a custom drop down field.

 

Thanks 

Hari G S

Hi all,

 

I have to cutomize a date field in Account Object. When a user tries to edit a date field, say Created Date, I need to check whether a value already exists in that filed, if exists I should not save the new value or should not allow the user to edit the field. If the value is empty I should be able to edit it save the new value. Using a trigger I can do this while editing and saving a Account Object. But from UI if a user performs edit how can I perform this check? Please help.

 

Thanks and Regards

Hari G S

Hi,

 

Can we upload a word document for a customer and edit this doc online?

 

Thanks

Hari

 

Hi,

 

I have a doubt in using Force.com ide. Can I mension the production url while deploying the code to production. The default url is salesforce.com. When i try to deploy a code it tries to connect to this url with the credentials i provide, but this is not actulay mu url. So the throws an error, Username or password is invalid.

 

Please help on this.

 

Thanks and Regards

Hari G S

 

Hi,

 

My requirment is to store only the Created Date in a separate field in Lead Object. Currently there is a field Created By in the Lead Object which contains Name and Date. Is there any simple method to store only the created date value in a separate field?

 

Thanks

Hari G S

  • September 10, 2012
  • Like
  • 0

Hi All,

 

The following code shows me an error message " Save error: Unable to perform save on all files: No match found " while saving the code.

 

global class DailyUpdateAccountsScheduler implements Schedulable{    
    global void execute(SchedulableContext SC) {
        list<Purchased_Products_del__c> purProd = [SELECT Account__c FROM Purchased_Products_del__c];
        set<Id> accIdSet = new set<Id>();
        if(purProd.size() > 0) {
            for(Purchased_Products_del__c pP : purProd) {                
                accIdSet.add(pP.Account__c);                
            }
        }        
        list<Account> accList = new list<Account>();
        list<Account> acctList = [select Name from Account];
        if(acctList.size() > 0) {
            for(Account accnt : acctList) {
                if(accIdSet.size() > 0) {
                    for(Id id : accIdSet) {
                        if(accnt.Id == id) {
                            accList.add(accnt);                            
                        }
                    }
                }
            }
        }        
    }
}

 

Can anyone please help me to resolve this. My ultimate aim is to update the list "accList".

The outer loop size ismore than 14000 and the inner loop is around 1050. Is this nested loop causing the problem .

 

Please help me.

 

Thanks and Regrds

Hari G S

 

Hi all,

 

Can anyone please help to wrute a Apex Scheduler that will be called every 1 hr.

 

What i have written is , public static String CRON_EXP = '0 * * * * ?';  this shows an error.

 

Plase help me.

 

Thnaks and Regards

Hari G S

 

 

 

Hi All,

 

I have a requirement that to sync my salesforce data with my marketing team. To sync data, it checks whether there is any change in the 'SystemModStamp' field. The 'SystemModStamp' will be updated only when any field change is occured. But my problem is, i have a formula field, its value will be increamented each day, but i could know that the change in a formula field will not affect the 'SystemModStamp' value. But some how i need to sync all my Account details, there are around 15000 Accounts.

 

I was thinking to write a apex scheduler which iterate through all the records and just update each records. Is it possible to do for all the 15000 records? Is there any other solution for doing this? Please help.

 

Thanks and Regards

Hari G S

Hi,

 

I have an array of  type AggregateResult. How to loop through this?

 

For Eg:

 

AggregateResult[] pp = [select min(Purchase_Date__c)Purchase_Date__c, Account__c from Purchased_Products_del__c group by Account__c];

 

When i loop using

 

for(Purchased_Products_del__c ppd : pp) {} shows an error

 

"Save error: Loop variable must be of type SOBJECT:AggregateResult"

 

Please help

 

Thanks and Regards

Hari G S

 

 

 

Hi,

 

The following code throws an error

 

Run Failures:
  SetContactEndDate.mySetContactEndDateTest System.LimitException: Too many SOQL queries: 101

 

list<Account> accs = [SELECT Id, Name, Old_Purchased_Product_Date__c FROM Account];
    String name = accs.size()+ ' *-* ';
    if(null != accs && accs.size() > 0) {
        for(Account acc : accs) {
            count++;
            if(count >= 0 && count <= 50) {
                Id id = acc.Id;
                AggregateResult[] puchasedProd = [select min(Purchase_Date__c)Purchase_Date__c from Purchased_Products_del__c where Account__c=:id];
                if(puchasedProd[0].get('Purchase_Date__c') != '' || puchasedProd[0].get('Purchase_Date__c') != null) {
                    //Account acct = [select Old_Purchased_Product_Date__c from Account where Id=:id];
                    name += acc.Name + ' *-* ';
                    //acc.Old_Purchased_Product_Date__c = (Date)puchasedProd[0].get('Purchase_Date__c');
                    //update acc;                
                }
            }
        }
    }

 

 

Please help me to resolve this......

 

Thanks and Regards,

Hari G S

Hi,

 

I would like to create a new custom field on my object Account, say Customer Age and it should be a Number field

 

The field should show the result of TODAY (current date) minus the oldest Purchased Product Date.

 

in SOQL we can write this a

 

AggregateResult[] puchasedProd = [select min(Purchase_Date__c)Purchase_Date__c from Purchased_Products_del__c where Account__c=:id];
Customer Age = puchasedProd[0].get('Purchase_Date__c').daysBetween(NOW());

 

Is this possible to do this calculation in a Formula field instead of using a trigger?

 

Thanks and Regards

Hari G S

 

Hi,

 

I have written a trigger

 

trigger duplicateLeadCheck on Lead (after insert, after update) {
    Lead mylead = trigger.new[0];
    String str = mylead.FirstName+'_'+mylead.Email;
    DuplicatLeadObject__c dupLeadObj = new DuplicatLeadObject__c();
    dupLeadObj.Name = str;
    //Long oneDay = 86400000;
    Long oneDay = 180000;
    Datetime currentTime = System.now();
    Long l2 = currentTime.getTime();
    list<Lead> leadList = [select Id, CreatedDate from Lead where Name_Email__c=:str];    
    if(leadList != null && leadList.size() > 0) {
        for(Lead lead : leadList) {
            Datetime createdDate = lead.CreatedDate;            
            Long l1 = createdDate.getTime();            
            if((l1+oneDay) > l2) {                
                dupLeadObj.Duplicate_Lead_Info__c = mylead.Working_Planet_Category_c1__c+'<br>'+mylead.Working_Planet_Source_source__c+'<br>'+mylead.Working_Planet_Keyword_kw__c+'<br>'+mylead.Working_Planet_Ad_cr5__c+'<br>'+mylead.Working_Planet_User_IP__c+'<br>'+mylead.Working_Planet_Timestamp__c+'<br>'+mylead.Company+'<br>'+mylead.Email+'<br>'+mylead.FirstName+'<br>'+mylead.LastName+'<br>'+mylead.Phone+'<br>'+mylead.Title;                
                insert dupLeadObj;
                delete mylead;
                //mylead.addError('Duplicate Lead');
            }
        }        
    }
}

 

while executing this i am getting an error like this

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger duplicateLeadCheck caused an unexpected exception, contact your administrator: duplicateLeadCheck: execution of AfterInsert caused by: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old: Trigger.duplicateLeadCheck: line 18, column 1

 

Please help me.

 

Thanks and Regards

Hari G S

 

Hi,

 

I have a doubt in trigger.

 

While creating a Lead object i have written a trigger to chack some details. If that check fails i wanted to write some information from the Lead object to my Custom Object, and this lead object should not be get inserted.

 

if((l1+oneDay) > l2) {
                DuplicatLeadObject__c dupLeadObj = new DuplicatLeadObject__c();
                dupLeadObj.Duplicate_Lead_Info__c = mylead.Working_Planet_Category_c1__c+'<br>'+mylead.Working_Planet_Source_source__c+'<br>'+mylead.Working_Planet_Keyword_kw__c+'<br>'+mylead.Working_Planet_Ad_cr5__c+'<br>'+mylead.Working_Planet_User_IP__c+'<br>'+mylead.Working_Planet_Timestamp__c+'<br>'+mylead.Company+'<br>'+mylead.Email+'<br>'+mylead.FirstName+'<br>'+mylead.LastName+'<br>'+mylead.Phone+'<br>'+mylead.Title;
                dupLeadObj.Name = str;
                insert dupLeadObj;
                mylead.addError('Duplicate Lead');
            }

 

This is how my code looks like, because of the addError function my Custom object is also not get inserted.

 

Is there a way to do this??

 

Thanks and Regards

Hari G S

 

Hi ,

 

I have added a Custom Object in Production and using trigger i have added some values in to this Custom Object. But how can i see these Object values. In report also it does not show this Custom Object.

 

Please help

 

Thanks and regards

Hari G S

Hi,

 

Can i keep a log file in SFDC through Triggers.

 

ie, When a trigger fails i need to write some information in a log file and it should be accessible through salesforce.com.

 

Thanks and Regards

Hari G S

 

Hi All

 

I have a doubt in soql query. I have given here a sample mysql query. How can it be converted to corresponding soql query?

 

Select Account.BillingState from Account,Contact where Contact.AccountId = Account.id and Contact.Ownerid =: id

 

Thanks and Regards,

Hari G S

Hi all,

 

I have to cutomize a date field in Account Object. When a user tries to edit a date field, say Created Date, I need to check whether a value already exists in that filed, if exists I should not save the new value or should not allow the user to edit the field. If the value is empty I should be able to edit it save the new value. Using a trigger I can do this while editing and saving a Account Object. But from UI if a user performs edit how can I perform this check? Please help.

 

Thanks and Regards

Hari G S

 

Hi,

 

I have a doubt in using Force.com ide. Can I mension the production url while deploying the code to production. The default url is salesforce.com. When i try to deploy a code it tries to connect to this url with the credentials i provide, but this is not actulay mu url. So the throws an error, Username or password is invalid.

 

Please help on this.

 

Thanks and Regards

Hari G S

 

Hi,

 

My requirment is to store only the Created Date in a separate field in Lead Object. Currently there is a field Created By in the Lead Object which contains Name and Date. Is there any simple method to store only the created date value in a separate field?

 

Thanks

Hari G S

  • September 10, 2012
  • Like
  • 0

 

Hi,

 

I have written a trigger

 

trigger duplicateLeadCheck on Lead (after insert, after update) {
    Lead mylead = trigger.new[0];
    String str = mylead.FirstName+'_'+mylead.Email;
    DuplicatLeadObject__c dupLeadObj = new DuplicatLeadObject__c();
    dupLeadObj.Name = str;
    //Long oneDay = 86400000;
    Long oneDay = 180000;
    Datetime currentTime = System.now();
    Long l2 = currentTime.getTime();
    list<Lead> leadList = [select Id, CreatedDate from Lead where Name_Email__c=:str];    
    if(leadList != null && leadList.size() > 0) {
        for(Lead lead : leadList) {
            Datetime createdDate = lead.CreatedDate;            
            Long l1 = createdDate.getTime();            
            if((l1+oneDay) > l2) {                
                dupLeadObj.Duplicate_Lead_Info__c = mylead.Working_Planet_Category_c1__c+'<br>'+mylead.Working_Planet_Source_source__c+'<br>'+mylead.Working_Planet_Keyword_kw__c+'<br>'+mylead.Working_Planet_Ad_cr5__c+'<br>'+mylead.Working_Planet_User_IP__c+'<br>'+mylead.Working_Planet_Timestamp__c+'<br>'+mylead.Company+'<br>'+mylead.Email+'<br>'+mylead.FirstName+'<br>'+mylead.LastName+'<br>'+mylead.Phone+'<br>'+mylead.Title;                
                insert dupLeadObj;
                delete mylead;
                //mylead.addError('Duplicate Lead');
            }
        }        
    }
}

 

while executing this i am getting an error like this

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger duplicateLeadCheck caused an unexpected exception, contact your administrator: duplicateLeadCheck: execution of AfterInsert caused by: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old: Trigger.duplicateLeadCheck: line 18, column 1

 

Please help me.

 

Thanks and Regards

Hari G S

 

Hi ,

 

I have added a Custom Object in Production and using trigger i have added some values in to this Custom Object. But how can i see these Object values. In report also it does not show this Custom Object.

 

Please help

 

Thanks and regards

Hari G S

Hi,

 

Can i keep a log file in SFDC through Triggers.

 

ie, When a trigger fails i need to write some information in a log file and it should be accessible through salesforce.com.

 

Thanks and Regards

Hari G S