• krupananda reddy
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 12
    Replies
When a batch job is scheduled to run, Its invocating several "SerialBatchApexRangeChunkHandler" other batch jobs (in my case its 64). Do we have any documentaion available on the same or whats happening internally on the platform ?
How about having a Utility built on the platform to migrate metadata between two instances ? Any ideas or comments are welcome.
Hi All,
Failed to create deployment: This container has a save in progress with deploymentId=1dr4C000000Pjg7. You may not enqueue a request until this completes.: Metadata Container ID
I keep getting this message when saving apex in developer console. I cant delete the process either, Do we have any soltuion for this permanently ?
I have created a new rich text area field under contact standard object and i couldn't attach an image to that field. Attached is the screen shot. pic is the rich text area field here in this scenario. Any thoughts are welcome.User-added image
When i created a lightning component and its related server side controller, i got the below error. There exists a server side controller with the name. And "ExpRep_lightnin" is my organization name space.
Failed to save undefined: No CONTROLLER named apex://ExpRep_lightnin.DisplayCaseController found: Source
I have visusalforce button, on click of it navigation should go back to home tab. i.e. /home/home.jsp. I tried this with javascript and pagereference method. With page reference method nothing is happening, but with js it saying "URL no longer exists."  Below is the js i used,
var returnURL;
		window.onload =  function() {
			returnURL = gup('retURL');
		};    
		function redirectBack() {
			window.location.href = '/' + returnURL;
		}
Pagerefernece i used ,
pageRef = new PageReference('/home/home.jsp');
return pageRef;
Any help is appreciated. Thanks in advance.
How can take entire metadata backup of my production org apart from using Force.com IDE or Third party priced tools.
Solutions and suggestion are welcome, thanks in advance.
 
How do i get the organization information i.e. user licenses remaining, used and for which type of user it is being used in Apex ?
I am successful in posting a chatter feed using connectApi, but the chatter post is done with the context user. But i wish one specific user  to post it all the time. lets say admin. But all the post methods that are mentioned in posts it from context user. Is there any way to do this.
Any advises/suggestions are appreciated. Thaks.
I have several triggers on User object and inturn the some handler classes related to triggers invoke future calls. But sometimes i see a strange exception like "Unable_to_lock_the_row" system exception. And i went through some the discussion boards on this but there is no exact resolution suggested for this.  Most likely the soltuion is none... http://www.slideshare.net/developerforce/concurrency-designpatterns-mt. 

If anybody has come across this sort of exception and could resolve it, please assist on this.

Many thanks in advance :)
I have generated Enterprise wsdl from one of my Developer org and tried generating apex class from that wsdl by logging into other develope org.

Its not showing any error while parsing but generating the following error when i click on generate.

Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType

Did anybody come across this? If so please help it out .
When a batch job is scheduled to run, Its invocating several "SerialBatchApexRangeChunkHandler" other batch jobs (in my case its 64). Do we have any documentaion available on the same or whats happening internally on the platform ?
Hi All,
Failed to create deployment: This container has a save in progress with deploymentId=1dr4C000000Pjg7. You may not enqueue a request until this completes.: Metadata Container ID
I keep getting this message when saving apex in developer console. I cant delete the process either, Do we have any soltuion for this permanently ?
When i created a lightning component and its related server side controller, i got the below error. There exists a server side controller with the name. And "ExpRep_lightnin" is my organization name space.
Failed to save undefined: No CONTROLLER named apex://ExpRep_lightnin.DisplayCaseController found: Source
I have visusalforce button, on click of it navigation should go back to home tab. i.e. /home/home.jsp. I tried this with javascript and pagereference method. With page reference method nothing is happening, but with js it saying "URL no longer exists."  Below is the js i used,
var returnURL;
		window.onload =  function() {
			returnURL = gup('retURL');
		};    
		function redirectBack() {
			window.location.href = '/' + returnURL;
		}
Pagerefernece i used ,
pageRef = new PageReference('/home/home.jsp');
return pageRef;
Any help is appreciated. Thanks in advance.
Iam trying to test the data to check if invoice with line item is not getting deleted, Iam getting above error.

@isTest
private class TestInvoiceStatementDeletion {
    static testmethod void TestDeleteInvoiceWithLineItem() {
// Create an invoice statement with a line item then try to delete it
Invoice_Statement__c inv = TestDataFactory.createOneInvoiceStatement(true);
Test.startTest();
Database.DeleteResult result = Database.delete(inv, false);
Test.stopTest();
// Verify invoice with a line item didn't get deleted.
System.assert(!result.isSuccess());
}
static testmethod void TestDeleteInvoiceWithoutLineItems() {
// Create an invoice statement without a line item and try to delete it
Invoice_Statement__c inv = TestDataFactory.createOneInvoiceStatement(false);
Test.startTest();
Database.DeleteResult result = Database.delete(inv, false);
Test.stopTest();
// Verify invoice without line items got deleted.
System.assert(result.isSuccess());
}
static testmethod void TestBulkDeleteInvoices() {
// Create two invoice statements, one with and one with out line items
// Then try to delete them both in a bulk operation, as might happen
// when a trigger fires.
List<Invoice_Statement__c> invList = new List<Invoice_Statement__c>();
invList.add(TestDataFactory.createOneInvoiceStatement(true));
invList.add(TestDataFactory.createOneInvoiceStatement(false));
Test.startTest();
Database.DeleteResult[] results = Database.delete(invList, false);
Test.stopTest();
// Verify the invoice with the line item didn't get deleted
System.assert(!results[0].isSuccess());
// Verity the invoice without line items did get deleted.
System.assert(results[1].isSuccess());
}
}
hi,
 i have faced one of the interview question like when ever web to case created. user send cases to particular organization if organization having multiple location like usa,india.then how i can find which location case will sending that particular location
I am trying to make a validation rule which stops users editing the email address of a contact or lead UNLESS the email field is blank.

I have tried the following both formulae to no avail:
Email <> "" && ISCHANGED(Email)
IF( Email <> "", ISCHANGED(Email), ISBLANK( Email ) )

The reason for this is that the Salesforce record is checked against a nother databse which uses email address as the unique identifier, so whenever the email address is changed in Salesforce, it creates a duplicate record (with the new email address) in the other database.

Any help is much appreciated!

 
Hello Users

I have a need to bulkify the below trigger.

This works great with the UI, however with an API bulk inserting, is causing some issues with SOQL 101 governing limit.

The process is, on the before insert of a lead, it checks to see if

1) an existing lead is in the database with the same email (update a field on lead if found), then delete the lead record after insert 
2) if an email address exists on the contact record, update the contact record if found, and delete the lead after insert.
3) Write a custom object (LDS__c) record with some details. (not important)

I am failing at line 75, when i query the contact object to update within the for loop

Contact Contact1 = [Select Id from Contact where Id =: ContactId limit 1];

I am failing in my test class to push in bulk records

All help is appreciated.

Lead before insert trigger
 
/******************************************************************
Created By : David Robinson (Blirt)
*******************************************************************/
trigger Lead_HDL_BI on Lead (before insert) {
    
    public string LeadEmail;
    public boolean ContactFound;
    public string ContactId;
    public boolean LeadFound;
    public string LeadId;
    Id LeadRTNonSearchable  = [SELECT Id,Name,DeveloperName FROM RecordType WHERE DeveloperName='Non_Searchable' AND SObjectType='Lead' LIMIT 1].Id;
    Id LeadRTSearchable     = [SELECT Id,Name,DeveloperName FROM RecordType WHERE DeveloperName='Searchable' AND SObjectType='Lead' LIMIT 1].Id;
    
    //Query Contacts for matching email address
    List<Contact> ContactList = [
        SELECT Id 
        FROM Contact
        WHERE Email =: LeadEmail 
        ORDER BY LastModifiedDate DESC
        LIMIT 1
    ]; 
    
    //Query Leads for matching email address
    List<Lead> LeadList = [
        SELECT Id 
        FROM Lead
        WHERE Email =: LeadEmail 
        AND IsConverted = false //Only include Non Converted Leads
        AND (RecordTypeId =: LeadRTSearchable OR RecordTypeId = null) //Only include Searchable Leads or RT = null
        ORDER BY LastModifiedDate DESC
        LIMIT 1
    ];     
    
    for(Lead record: Trigger.new) {

        try{
            LeadEmail = record.Email.trim();
        }catch(Exception e){
        }
       
        if(record.LeadSource == 'Big Commerce Book Purchase') {
            record.Book_Purchaser__c = 'Yes';
        }           
        if(record.LeadSource == 'Blog Subscriber') {
            record.Blog_Subscriber__c = 'Yes';
        } 

        ContactId = null;
        
        try{
            ContactId = ContactList[0].Id;
            ContactFound=true;
        }catch(Exception e){
            ContactId = null;
            ContactFound=false;
        }
        
        LeadId = null;
        
        try{
            LeadId = LeadList[0].Id;
            LeadFound=true;
        }catch(Exception e){
            LeadId = null;
            LeadFound=false;
        }  
        //Only run when email address field has a value
        if(record.Email!=null){
            //Run if Contact with same email Found
            if(ContactFound=true){
                //Update Contact and Lead   
                if(record.LeadSource == 'Big Commerce Book Purchase') { 
                    try{
                        //Update Found Contact
                        Contact Contact1 = [Select Id from Contact where Id =: ContactId limit 1];
                        Contact1.Book_Purchaser__c = 'Yes';
                        Contact1.Book_Purchase_date__c = record.Book_Purchase_date__c;  
                        update Contact1;  
                        //Update New Lead
                        record.TriggerDelete__c=true;
                        //Insert log record
                        LDS__c LeadLog = new LDS__c(
                            CreatedDate__c=datetime.now()
                            ,Company__c=record.Company
                            ,Description__c='ContactFound=true, record.LeadSource == Big Commerce Book Purchase'
                            ,Email__c=record.Email
                            ,FirstName__c=record.FirstName
                            ,LastName__c=record.LastName
                            ,LeadSource__c=record.LeadSource
                            ,Book_Purchase_date__c=record.Book_Purchase_date__c
                            ,Blog_Subscription_date__c=record.Blog_Subscription_date__c
                        );
                        //insert LeadLog;                                
                    }catch(Exception e){
                    }                                       
                } 
                //Update Contact and Lead           
                if(record.LeadSource == 'Blog Subscriber') {
                    try{
                        //Update Found Contact
                        Contact Contact1 = [Select Id from Contact where Id =: ContactId limit 1];
                        Contact1.Blog_Subscriber__c = 'Yes'; 
                        Contact1.Blog_Subscription_date__c = record.Blog_Subscription_date__c; 
                        update Contact1;
                        //Update New Lead
                        record.TriggerDelete__c=true;
                        //Insert log record
                        LDS__c LeadLog = new LDS__c(
                            CreatedDate__c=datetime.now()
                            ,Company__c=record.Company
                            ,Description__c='ContactFound=true, record.LeadSource == Blog Subscriber'
                            ,Email__c=record.Email
                            ,FirstName__c=record.FirstName
                            ,LastName__c=record.LastName
                            ,LeadSource__c=record.LeadSource
                            ,Book_Purchase_date__c=record.Book_Purchase_date__c
                            ,Blog_Subscription_date__c=record.Blog_Subscription_date__c
                        );
                        insert LeadLog;                                         
                    }catch(Exception e){
                    }                         
                } 
            }
            //Run if Lead with same email Found
            if(LeadFound=true){
                //Update Lead
                if(record.LeadSource == 'Big Commerce Book Purchase') { 
                    try{
                        //Update Found Lead
                        Lead Lead1 = [Select Id from Lead where Id =: LeadId limit 1];
                        Lead1.Book_Purchaser__c = 'Yes'; 
                        Lead1.Book_Purchase_date__c = record.Book_Purchase_date__c; 
                        update Lead1;                      
                        //Update New Lead
                        record.TriggerDelete__c=true;
                        //Insert log record
                        LDS__c LeadLog = new LDS__c(
                            CreatedDate__c=datetime.now()
                            ,Company__c=record.Company
                            ,Description__c='LeadFound=true, record.LeadSource == Big Commerce Book Purchase'
                            ,Email__c=record.Email
                            ,FirstName__c=record.FirstName
                            ,LastName__c=record.LastName
                            ,LeadSource__c=record.LeadSource
                            ,Book_Purchase_date__c=record.Book_Purchase_date__c
                            ,Blog_Subscription_date__c=record.Blog_Subscription_date__c
                        );
                        insert LeadLog;                         
                    }catch(Exception e){
                    }                 
                } 
                //Update Lead           
                if(record.LeadSource == 'Blog Subscriber') {
                    try{
                        //Update Found Lead
                        Lead Lead1 = [Select Id from Lead where Id =: LeadId limit 1];
                        Lead1.Blog_Subscriber__c = 'Yes'; 
                        Lead1.Blog_Subscription_date__c = record.Blog_Subscription_date__c;
                        update Lead1;                       
                        //Update New Lead
                        record.TriggerDelete__c=true;
                        //Insert log record
                        LDS__c LeadLog = new LDS__c(
                            CreatedDate__c=datetime.now()
                            ,Company__c=record.Company
                            ,Description__c='LeadFound=true, record.LeadSource == Blog Subscriber'
                            ,Email__c=record.Email
                            ,FirstName__c=record.FirstName
                            ,LastName__c=record.LastName
                            ,LeadSource__c=record.LeadSource
                            ,Book_Purchase_date__c=record.Book_Purchase_date__c
                            ,Blog_Subscription_date__c=record.Blog_Subscription_date__c
                        );
                        insert LeadLog;                             
                    }catch(Exception e){
                    }                                              
                } 
            }            
        }
    }
}

Lead after insert (delete record)
 
/******************************************************************
Created By : David Robinson (Blirt)
*******************************************************************/
trigger Lead_HDL_AI on Lead (after insert) {
    for(Lead record: Trigger.new) {
        //Query Lead
        List<Lead> LeadList = [SELECT Id FROM Lead WHERE Id =:record.Id LIMIT 1]; 
        //Delete Lead
        if(record.TriggerDelete__c==true){try{DELETE LeadList;}catch(Exception e){}                          
        }
    }   
}



Lead test class
 
/******************************************************************
Created By : David Robinson Blirt
*******************************************************************/
@isTest
private without sharing class Lead_HDL_TC{

    /******************************************************************
    Declare all record variables here. 
    Examples: 
        private static Account AC1;
        private static Tax__c TA1;
    ********************************************************************/
    
    private static Account AC1;
    private static Contact CO1;
    private static Lead L1;
    private static Lead L2;
    private static Lead L3;
    private static Lead L4;
    private static Lead L5;
      
    /******************************************************************
    Write your Test Methods Here. You can write as many as you like
    ********************************************************************/

    static testMethod void TestBatch() {
        try {
            insert createLeads(200);
            System.assert(false, 'Exception expected');
        } catch (DmlException e) {
            System.assertEquals(200 - 100, e.getNumDml());
        }
    }

    //static testMethod void Increment() {
    //    insert createLeads(98);
    //    try {
    //        insert createLeads(5);
    //        System.assert(false, 'Exception expected');
    //    } catch (DmlException e) {
    //        System.assertEquals(100 - 98 + 5, e.getNumDml());
    //    }
    //}

    private static Lead[] createLeads(Integer n) {
        Lead[] leads = new Lead[] {};
        for(Integer i = 0; i < n; i++) {
            leads.add(new Lead(
		            FirstName='F1'+ i
		            ,LastName='L1'+ i
		            ,Email='test@test'+ i +'.com'
		            ,Status='Open'
		            ,Company='Test1'
		            ,LeadSource='Big Commerce Book Purchase'
		            ,TriggerDelete__c=false   
	            ));
        }
        return leads;
    }

    private static testMethod void TestUI() {   
        
        /***********************************************************
        * INSERT TEST METHODS HERE
        ************************************************************/
        insertTestAccounts(); 
        insertTestContacts();
        //insertTestLeads();                           
        
    } 
    
    /******************************************************************
    Write your InsertRecord functions here.
    ********************************************************************/

    // INSERT ACCOUNTS
    
    public static void insertTestAccounts()
    {

        List<Account> remRecords= [SELECT Id FROM Account];  
        DELETE remRecords;
        System.assertEquals(0,[SELECT count() FROM Account]);
                      
        List<Account> Accounts = new List<Account>();      
        
        AC1 = NEW Account(
             Name='Test1'
        );

        Accounts.add(AC1);                           
        
        INSERT Accounts;
        UPDATE Accounts;
        
        System.assertEquals(1,[SELECT count() FROM Account]);
    }  

    // INSERT CONTACTS
    
    public static void insertTestContacts()
    {

        List<Contact> remRecords= [SELECT Id FROM Contact];  
        DELETE remRecords;
        System.assertEquals(0,[SELECT count() FROM Contact]);
                      
        List<Contact> Contacts = new List<Contact>();      
        
        CO1 = NEW Contact(
            FirstName='F1'
            ,LastName='L1'
            ,Account=AC1
            ,Email='test@test.com'
        );
   
        Contacts.add(CO1);                           
        
        INSERT Contacts;
        UPDATE Contacts;
        
        System.assertEquals(1,[SELECT count() FROM Contact]);
    }       

    // INSERT LEADS
    
    public static void insertTestLeads()
    {

        //List<Lead> remRecords= [SELECT Id FROM Lead];  
        //DELETE remRecords;
        //System.assertEquals(0,[SELECT count() FROM Lead]);
                      
        List<Lead> Leads = new List<Lead>();      
        
        L1 = NEW Lead(
            FirstName='F1'
            ,LastName='L1'
            ,Email='test@test.com'
            ,Status='Open'
            ,Company='Test1'
            ,LeadSource='Big Commerce Book Purchase'
            ,TriggerDelete__c=false
            
        );

        L2 = NEW Lead(
            FirstName='F1'
            ,LastName='L1'
            ,Email='test@test.com'
            ,Status='Open'
            ,Company='Test1'
            ,LeadSource='Blog Subscriber'
            ,TriggerDelete__c=false
            
        );

        L3 = NEW Lead(
            FirstName='F1'
            ,LastName='L1'
            ,Email='test41234234234324324@test.com'
            ,Status='Open'
            ,Company='Test1'
            ,LeadSource='Some Other Source'
            ,TriggerDelete__c=false
            
        );

        L4 = NEW Lead(
            FirstName='F1'
            ,LastName='L1'
            ,Email='test@test.com'
            ,Status='Open'
            ,Company='Test1'
            ,LeadSource='Blog Subscriber'
            ,TriggerDelete__c=false
            
        );

        L5 = NEW Lead(
            FirstName='F1'
            ,LastName='L1'
            ,Email='test12121@1212121test.com'
            ,Status='Open'
            ,Company='Test1'
            ,LeadSource='Blog Subscriber'
            ,TriggerDelete__c=true
            
        );
   
        Leads.add(L1);   
        Leads.add(L2); 
        Leads.add(L3);                          
        Leads.add(L4);  
        Leads.add(L5); 
                
        INSERT Leads;
        //UPDATE Leads;
        
        //System.assertEquals(5,[SELECT count() FROM Lead]);

    }      

}



 
How can take entire metadata backup of my production org apart from using Force.com IDE or Third party priced tools.
Solutions and suggestion are welcome, thanks in advance.
 
<apex:pageBlockTable value="{!accountWrapperList}" var="rowEntry">
  <apex:repeat value="{!columnList}" var = "colEntry">
     <apex:dymanicComponent value="{!myDynamicColumn}"/>
  </apex:repeat>
</apex:pageBlockTable>

I'm trying to do something like the above where a pageBlockTable iterates over a list.  Then within the table, the columns are determined via another list that contains a data structure with some info on the column including the label in a String member and the API Name in another string member.  Then a dynamicComponent is included to generate the apex:column which will contain some more complex VF inside it.  (It would be a very lengthy discussion to explain why I want to do that so I'll skip it for now.)

I'm not sure what I'm trying to do can be accomplished.  For the value expression on the element that will contain the value, I think expression would have to be evalated twice.  First an explession needs to be evaluated to get the field name, then an expression is needed for the value.

It's as if what I woud want to code be someting that returns a Component.Apex.Column and either that column or an element within that column would have an element equivelent to --
expressions.value = "{!rowEntry.{!colEntry.apiName}}"
But obviously that makes no sense.

I can't think of anyway to code a getter for the dynamic component I want in this scenario. 

Anyone that has any ideas, feel free to chime in.