• ppiyush
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 20
    Replies

Does anyone know if we have API access to "Unresolved items" in particular, the events.... is there anyway I can create a lookup to someone else's "unresolved items"?

 

any help on this topic would be appreciated...!

Hi,

 

I have a lookup field called Related_Contact__c on an Opportunity which is a lookup to a Contact record. How can I access the Account for this Contact through the lookup field. I am trying the following, but doesnt seem to work - the error report tells me that there is an "unexpected token: Account"

 

SELECT id, StageName, Sub_Stage__c, Start_Date__c, End_Date__c FROM Opportunity WHERE (Related_Contact__c.Account:=Account)

 

The comparison I am trying to make here is between the Account field of the Related_Contact__c lookup and the Account field on the Opportunity itself.

 

Any recommendations?

Hello!

 

In relation to my previous post, here's another request. I have refreshed my sandbox recently, so cant refresh again to populate all my users accordingly.

 

Now, I have one user account (in LIVE) that I want to also open in Sandbox - but I dont want to wait for another 30 days for a refresh of Sandbox.

 

Is there any way of creating the same user in Sandbox (with the same ID)?

 

Best,

Pranav

Hello!

 

I wanted to transfer the ownership of some Apex Classes and Triggers to another user (also System Admin) and was wondering how I go about doing that?

 

Would I have to re-create them? Or is there a way of re-assigning them from within Salesfore Setup page?

 

Any guidance would be extremely helpful.

 

thanks,

Pranav

Hi there,

 

I have a Batch Apex class that I am trying to test, and for some reason, the test is successful in the Sandbox - when I run it from the IDE, but unsuccessful during deployment.

 

Code is below - any clues would be highly appreciated!

 

 

global class OpenProjectsCount implements Database.Batchable<sObject>{
	
	String query;
	
	global OpenProjectsCount(){
		query = 'SELECT id, Open_Projects__c FROM Contact';
	}
	
	global Database.QueryLocator start(Database.BatchableContext BC){
	
	   return Database.getQueryLocator(query);
	}
	
	global void execute(Database.BatchableContext BC, List<Contact> scope){
		for(Contact c:scope){
			c.Open_Projects__c = [select Count() from Opportunity where Related_Contact__c =: c.id and StageName!='Lost' and StageName!='Finished' and StageName!='Cancelled'];
		}
		update scope; 
	}
	
	global void finish(Database.BatchableContext BC){

	}

}

 

 

and the test class is:

 

 

@isTest
private class TestOpenProjects {

    static testMethod void myUnitTest() {
        Contact c = new Contact(LastName='TestContact');
        insert c;
        
        List <Opportunity> opp = new List<Opportunity>();
        
        for(integer i=0; i<200; i++){
        	Opportunity o = new Opportunity(Name='Test Project'+i, Related_Contact__c=c.id, StageName='Discussions', CloseDate=date.today());
        	opp.add(o);
        }
        insert opp;
        
        Test.StartTest();
        OpenProjectsCount ops = new OpenProjectsCount();
        ID batchprocessid = Database.executebatch(ops);
        Test.StopTest();
        
        List<Contact> con = [SELECT Open_Projects__c FROM Contact WHERE id=:c.id];
        System.assertEquals(con[0].Open_Project__c, 200);
    }
}

 

 

Of course, if I remove the System Assert, at least I dont fail the test, and I am able to deploy the class, but this is still an area of concern to me. Any pointers would be extremely helpful!

 

thanks,

Pranav

 

  • September 14, 2010
  • Like
  • 0

Hello!

 

I am trying to figure out a way through which I could trigger a workflow based on the value contained inside a formula field. I obviously can create a normal workflow, but that would allow me only to check the value at the instance when a record is created or edited. Is there any way of doing it EVERY time the value of a particular field changes?

 

Is there a way to do this in Apex or through custom fields / workflows?

 

Best,

Pranav

Hello!

 

I am trying to figure out a way through which I could trigger a workflow based on the value contained inside a formula field. I obviously can create a normal workflow, but that would allow me only to check the value at the instance when a record is created or edited. Is there any way of doing it EVERY time the value of a particular field changes?

 

Look forward to some encouraging solutions.

 

Best,

Pranav

Hello!

 

I tried to delete from eclipse, and because the apex classes were linked to some vf pages, they didnt get deleted in the live instance, however, got deleted in the eclipse IDE.

 

Now, I see no way of deleting the classes I want in the live instance.

 

How does one do this?

 

Pranav

Hi, I am using a formula field to get the Ultimate Parent (Account) of every contact and every opportunity - however obviously this is stored as a text field.

 

now, when I run reports on these contacts and opportunities, and try to restrict by the Ultimated Parent using this formula field, some contacts from other Accounts show up here which shouldnt.

 

I realized that this is happening because Salesforce is unable to differentiate between IDs with different cases if they are coming from a text field. Example:

 

Account ABC - 0012000000UDldR

Account DEF - 0012000000UDldr

 

Notice that the case of the last letter is different, but when creating a criteria in a report to filter by any of these IDs, Salesforce is unable to filter properly.

 

Any workaround for such an issue?

 

Best,

Pranav

I have been trying to write a particular query in apex which is failing (during a batch apex). here it is:

 

 

query = 'SELECT id, Umantis_Account_ID__c, Ultimate_Parent_Account__c, Ultimate_Parent_Id__c, Related_Contact__c FROM Opportunity WHERE (Project_Code__c !=\'Budget\') AND (Umantis_NUM_ID__c LIKE Primary_Contacts_Umantis_ID__c)

 

 

This just doesnt work, and I get an error message in my Apex Jobs Log that looks like this:

 

 

First error: unexpected token: 'Primary_Contacts_Umantis_ID__c'

 

If I remove the second condition in the WHERE statement, everything works fine... which is also strange. For the LIKE operator, do both columns need to be text columns?

 

Best,

Pranav

 

Hello!

 

We are in the professional services business, and we often work with organizations with multi-level hierarchies (3 to 4 levels is very average). I was wondering if anyone knows how one can create a script to automatically find out the ultimate parent of any account / contact / project, and store the result in a field on every entity.

 

this would allow us to create savvy rollups in our reporting and dashboarding. any help will be much appreciated.

 

thanks,

Pranav

Hello everyone!

 

What I would like to do is to create a trigger which sets the primary contact role of an opportunity to a custom field I have created called "Primary Contact". Now I got some code off the internet which does it for me, and it works well, but I am not sure how it does it....

 

Can anyone enlighten me?  I want to make sure I am implementing the right stuff...

 

 

trigger ContactRoleUpdate on Opportunity (after update) {

	Opportunities o = new Opportunities();   
	o.SetContactRoleDefaults(Trigger.new);

}

 

And the Opportunities class is:

 

 

public class Opportunities {

    // Default Constructor
    public Opportunities()
    {
    }

    // Sets default values on the Contact Role record created during Conversion. Called on AFTER INSERT
    public void SetContactRoleDefaults(Opportunity[] oppty)
    {

	for(OpportunityContactRole oldocr:[select Id,IsPrimary,Role from OpportunityContactRole where OpportunityId in :oppty]) {
		if (oldocr.IsPrimary=true){
			delete oldocr;
		}
	}
	
	
	OpportunityContactRole ocr = new OpportunityContactRole();
	ocr.OpportunityId = oppty[0].id;
	ocr.ContactId = oppty[0].Related_Contact__c;
	ocr.IsPrimary = true;
	ocr.Role = 'Business User';
	
	insert ocr;

    }
}

 

 

 

Best regards,

Pranav

Hi Everyone,

 

I have seen this wiki article http://wiki.developerforce.com/index.php/Sorting_Tables. I implemented this exactly in the sandbox and the code works absolutely fine.

 

Now, I have tried to adapt this to a different apex class / visualforce page, but somehow the sorting doesnt work when I put the doSort function into an extesion class. see below:

 

Visualforce Page

 

<apex:page standardController="Account" extensions="testContact">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!cntz}" var="o" id="table">
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink value="{!$ObjectType.Contact.Fields.Name.Label}" action="{!doSort}" rerender="table">
                            <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                        </apex:commandLink> 
                    </apex:facet>
                    <apex:inputField value="{!o.name}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

And here is the apex class which is the extension to the Accoun standardController in the visualforce page above:

 

public class testContact {
    
    private List<Contact> cntz;
    private Account acct; 
    public String sortField {get; set;}
    public String previousSortField {get; set;}

    public testContact(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();
    }
    
    public Account getAt()
    {
        Account[] at = [Select id,name FROM Account where id= :acct.id];
        if(at.size()>0){
    		return at[0];
    	}
    	else{
    		return null;
    	}
    }
            
    public List<Contact> getCntz()
    {
        Account act = [Select id FROM Account where id = :acct.id];
        cntz = [Select id, Name, Client_Potential__c, title, Address_City__c, Direct_Phone__c, Email, Days_Since_Last_Contact__c, Owner.alias, Divisional_Account__c from Contact where ((account.parentid = :act.id OR account.id = :act.id)AND LastName!='Budget')];
    	return cntz;
    }

    public void UpdateRecords() {
        // this simple line of code finds out which column was changed and update the 
        // relevant account record accordingly!
        update cntz;
    }
    
        public void doSort(){
        String order = 'asc';
        
        /*This checks to see if the same header was click two times in a row, if so 
        it switches the order.*/
        if(previousSortField == sortField){
            order = 'desc';
            previousSortField = null;
        }else{
            previousSortField = sortField;
        }
       
        //To sort the table we simply need to use this one line, nice!
        superSort.sortList(cntz,sortField,order);
    }


}

 

 The main purpose of this class is to show all children contacts of a parent account (even if they are attached to a child account of a prent account). Now once I have this list, I would like to sort it (which is why I used the sorting funciton), but somehow this doesnt work. No errors in testing, but just doesnt work as expected!

 

Any help would be much appreciated.

 

Thanks,

Pranav

Hi there,

 

I need to reference the AccountId of an opportunity in apex. How do I best do this?

 

Lets say opp is an Opportunity. Is opp.get(Accountid) not valid?

 

It's returning null for me everytime I try.

 

Best regards,

Pranav

Hello!

 

I am referring to the code sample on Sorting Tables (apex tables) found here: http://wiki.developerforce.com/index.php/Sorting_Tables.

 

Now, even though this article says that code coverage with the included testmethods should be 100%, I am not getting this result. It comes to about 58% on the class superSort.

 

The lines not being tested are:

 

if(items[0].getSObjectType().getDescribe().fields.getMap().get(sortField).getDescribe().getType().Name() == 'REFERENCE'){
            isSortFieldReference = true;
            referenceName = new Map<Id,String>();
            
            /*Determine the type of this object and populate the Id to Name map*/
            Set<Id> referenceIds = new Set<Id>();
            for(sObject s : items){
               referenceIds.add((Id)s.get(sortField));
            }
            
            String objectID = (String)items[0].get(sortField);
            String prefix = objectID.substring(0,3);
            String objectType;
            Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
            for(Schema.SObjectType s : gd.values()){
                if(prefix == s.getDescribe().getKeyPrefix()){
                    objectType = s.getDescribe().Name;
                }
            }
            
            //Query the related objects for the name and populate the Id -> Name map
            String queryString = 'select Id, Name from ' + objectType + ' where ID IN :referenceIDs';
            for(sObject s : Database.query(queryString )){
                referenceName.put((Id)s.get('Id'),(String)s.get('Name'));
            }
        }

 

And the test method I am using is:

 

 

    public static testMethod void relatedSortTest(){
        
        List<Opportunity> opps = new List<Opportunity>();
        Account a = new Account();
        for(integer i = 0; i<1000; i++){
            opps.add(new Opportunity(Name = 'test' + i, Amount = 1, Account = a));
        }
        
        Test.startTest();
        sortList(opps,'Accountid','desc');
        Test.stopTest();
         
    }

 

 

Now, I believe the purpose of this piece of code is to allow sort on even a reference field which is why I am testing with Account on Opportunities, but somehow this is always throwing the following error message:

 

NullPointerException: Attempt to  de-reference  a null object - at this line - String prefix = objectID.substring(0,3);

Has anyone encountered this situation, or have a solution to this?

 

Thanks,

Pranav

Hi,

Does anyone know what are the possible values in the following xml attribute (in the O_Dictionary.xml file) ?

<ConflictResolution entity="Event" value="Notify" />

I see Notify, but I want to change this to the value corresponding to the option called "Salesforce always wins" - how do I do that? I have already disabled users from viewing this option, so cant ask each user to do it. I will probably re-write the dictionary file. would be great if you can let me know soon.

thanks,
Pranav

How can I test a pagereference method such as below:

 

 

public class childContact {
    
    private List<Contact> cntz;
    private Account acct; 

    public childContact(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();
    }
    
    public Account getAt()
    {
        Account[] at = [Select id,name FROM Account where id= :acct.id];
        if(at.size()>0){
    		return at[0];
    	}
    	else{
    		return null;
    	}
    }
            
    public List<Contact> getCntz()
    {
        Account act = [Select id FROM Account where id = :acct.id];
        cntz = [Select id, Name, Client_Potential__c, title, Address_City__c, Direct_Phone__c, Email, Open_Projects__c, Days_Since_Last_Contact__c, Account.name, Ownerid from Contact where (account.parentid = :act.id OR account.id = :act.id)];
    	return cntz;
    }

    public PageReference UpdateRecords() {
        // this simple line of code finds out which column was changed and update the 
        // relevant account record accordingly!
        update cntz;
        return null;
      }


}

 

The Visual Force pageBlockButton using the pagereference method looks like this:

 

  <apex:pageBlockButtons location="top">
    <apex:commandButton value="Update" action="{!UpdateRecords}" id="theButton" rerender="page" status="status" onComplete="window.location.reload()"></apex:commandButton>
  </apex:pageBlockButtons>   

Any help is much appreciated - thanks!

Hi there,

 

I have the following controller extension, and corresponding unit test. I want to find out why the assertion fails. How do I initialize the controller in the right way, so that the getAt() function sends back the correct account name?

 

extension class:

 

public class childAccount {
    
    private List<Account> acctz;
    private Account acct; 

    public childAccount(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();
    }
    
    public String getAt()
    {
        Account[] at = [Select name FROM Account where id= :acct.id];
    	if(at.size()>0){
    		return at[0].Name;
    	}
    	else{
    		return null;
    	}
    }
            
    public List<Account> getAcctz()
    {
        Account act = [Select id FROM Account where id = :acct.id];
        acctz = [Select id, Name, Address_Street__c, Address_City__c, Office__c, Type, parentid, Ownerid from Account where parentid = :act.id];
    	return acctz;
    }
}

 

test class:

 

@isTest
private class childAccountTest {

    static testMethod void myUnitTest() {    	
    	
    	Account a = new Account(Name='Test Account');
    	
		ApexPages.StandardController sc = new ApexPages.StandardController(a);
		childAccount cont = new childAccount(sc);
		
		system.assertEquals(a.Name,cont.getAt());
    }
}

 

 

 

Hello!

 

I am new to Apex / Visualforce, so will appreciate any help with the following. I have created a custom list using visual force to display all child accounts in a related list. I would like to repeat the same for Contacts of child accounts in the page for parent account.

 

Now, having done that, how do I implement pagination - if the number of contacts / child accounts is significant?

 

See my apex code below:

 

<apex:page standardController="Account" extensions="childAccount">

<style>

.fewerMore { display: none;}

</style>

<apex:form >

 <apex:pageMessages />

 <apex:detail relatedList="true"></apex:detail>

<apex:pageblock id="CustomList" title="Child Accounts"  >

   <apex:pageBlockTable value="{!acctz}" var="o" rendered="{!NOT(ISNULL(acctz))}">

        <apex:column headerValue="Action" >

            <apex:outputLink value="/{!o.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="color:blue; text-decoration:none">Edit</apex:outputLink>

        </apex:column>       

        <apex:column headerValue="Name"> <apex:outputLink value="/{!o.id}">{!o.Name}</apex:outputLink> </apex:column>

        <apex:column value="{!o.Address_Street__c}"/>

        <apex:column value="{!o.Address_City__c}"/>

    <apex:column value="{!o.Office__c}"/>

        <apex:column value="{!o.Type}"/>

   </apex:pageBlockTable>

   <apex:outputLabel value="No records to display" rendered="{!(ISNULL(acctz))}"></apex:outputLabel>

 </apex:pageblock>

 

</apex:form>

</apex:page>

 

 

 

 

public class childAccount {

   

    private List<Account> acctz;

    private Account acct;

 

    public childAccount(ApexPages.StandardController controller) {

        this.acct= (Account)controller.getRecord();

    }

 

    public List<Account> getAcctz()

    {

        Account act = [Select id FROM Account where id = :acct.id];

        acctz = [Select id, Name, Address_Street__c, Address_City__c, Office__c, Type from Account where parentid = :act.id];

    return acctz;

    }

}

 

 

Hi,

 

I have a lookup field called Related_Contact__c on an Opportunity which is a lookup to a Contact record. How can I access the Account for this Contact through the lookup field. I am trying the following, but doesnt seem to work - the error report tells me that there is an "unexpected token: Account"

 

SELECT id, StageName, Sub_Stage__c, Start_Date__c, End_Date__c FROM Opportunity WHERE (Related_Contact__c.Account:=Account)

 

The comparison I am trying to make here is between the Account field of the Related_Contact__c lookup and the Account field on the Opportunity itself.

 

Any recommendations?

Hello!

 

I wanted to transfer the ownership of some Apex Classes and Triggers to another user (also System Admin) and was wondering how I go about doing that?

 

Would I have to re-create them? Or is there a way of re-assigning them from within Salesfore Setup page?

 

Any guidance would be extremely helpful.

 

thanks,

Pranav

Hi there,

 

I have a Batch Apex class that I am trying to test, and for some reason, the test is successful in the Sandbox - when I run it from the IDE, but unsuccessful during deployment.

 

Code is below - any clues would be highly appreciated!

 

 

global class OpenProjectsCount implements Database.Batchable<sObject>{
	
	String query;
	
	global OpenProjectsCount(){
		query = 'SELECT id, Open_Projects__c FROM Contact';
	}
	
	global Database.QueryLocator start(Database.BatchableContext BC){
	
	   return Database.getQueryLocator(query);
	}
	
	global void execute(Database.BatchableContext BC, List<Contact> scope){
		for(Contact c:scope){
			c.Open_Projects__c = [select Count() from Opportunity where Related_Contact__c =: c.id and StageName!='Lost' and StageName!='Finished' and StageName!='Cancelled'];
		}
		update scope; 
	}
	
	global void finish(Database.BatchableContext BC){

	}

}

 

 

and the test class is:

 

 

@isTest
private class TestOpenProjects {

    static testMethod void myUnitTest() {
        Contact c = new Contact(LastName='TestContact');
        insert c;
        
        List <Opportunity> opp = new List<Opportunity>();
        
        for(integer i=0; i<200; i++){
        	Opportunity o = new Opportunity(Name='Test Project'+i, Related_Contact__c=c.id, StageName='Discussions', CloseDate=date.today());
        	opp.add(o);
        }
        insert opp;
        
        Test.StartTest();
        OpenProjectsCount ops = new OpenProjectsCount();
        ID batchprocessid = Database.executebatch(ops);
        Test.StopTest();
        
        List<Contact> con = [SELECT Open_Projects__c FROM Contact WHERE id=:c.id];
        System.assertEquals(con[0].Open_Project__c, 200);
    }
}

 

 

Of course, if I remove the System Assert, at least I dont fail the test, and I am able to deploy the class, but this is still an area of concern to me. Any pointers would be extremely helpful!

 

thanks,

Pranav

 

  • September 14, 2010
  • Like
  • 0

Hello!

 

I am trying to figure out a way through which I could trigger a workflow based on the value contained inside a formula field. I obviously can create a normal workflow, but that would allow me only to check the value at the instance when a record is created or edited. Is there any way of doing it EVERY time the value of a particular field changes?

 

Is there a way to do this in Apex or through custom fields / workflows?

 

Best,

Pranav

Hi, I am using a formula field to get the Ultimate Parent (Account) of every contact and every opportunity - however obviously this is stored as a text field.

 

now, when I run reports on these contacts and opportunities, and try to restrict by the Ultimated Parent using this formula field, some contacts from other Accounts show up here which shouldnt.

 

I realized that this is happening because Salesforce is unable to differentiate between IDs with different cases if they are coming from a text field. Example:

 

Account ABC - 0012000000UDldR

Account DEF - 0012000000UDldr

 

Notice that the case of the last letter is different, but when creating a criteria in a report to filter by any of these IDs, Salesforce is unable to filter properly.

 

Any workaround for such an issue?

 

Best,

Pranav

I have been trying to write a particular query in apex which is failing (during a batch apex). here it is:

 

 

query = 'SELECT id, Umantis_Account_ID__c, Ultimate_Parent_Account__c, Ultimate_Parent_Id__c, Related_Contact__c FROM Opportunity WHERE (Project_Code__c !=\'Budget\') AND (Umantis_NUM_ID__c LIKE Primary_Contacts_Umantis_ID__c)

 

 

This just doesnt work, and I get an error message in my Apex Jobs Log that looks like this:

 

 

First error: unexpected token: 'Primary_Contacts_Umantis_ID__c'

 

If I remove the second condition in the WHERE statement, everything works fine... which is also strange. For the LIKE operator, do both columns need to be text columns?

 

Best,

Pranav

 

Hello!

 

We are in the professional services business, and we often work with organizations with multi-level hierarchies (3 to 4 levels is very average). I was wondering if anyone knows how one can create a script to automatically find out the ultimate parent of any account / contact / project, and store the result in a field on every entity.

 

this would allow us to create savvy rollups in our reporting and dashboarding. any help will be much appreciated.

 

thanks,

Pranav

Hi Everyone,

 

I have seen this wiki article http://wiki.developerforce.com/index.php/Sorting_Tables. I implemented this exactly in the sandbox and the code works absolutely fine.

 

Now, I have tried to adapt this to a different apex class / visualforce page, but somehow the sorting doesnt work when I put the doSort function into an extesion class. see below:

 

Visualforce Page

 

<apex:page standardController="Account" extensions="testContact">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!cntz}" var="o" id="table">
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink value="{!$ObjectType.Contact.Fields.Name.Label}" action="{!doSort}" rerender="table">
                            <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                        </apex:commandLink> 
                    </apex:facet>
                    <apex:inputField value="{!o.name}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

And here is the apex class which is the extension to the Accoun standardController in the visualforce page above:

 

public class testContact {
    
    private List<Contact> cntz;
    private Account acct; 
    public String sortField {get; set;}
    public String previousSortField {get; set;}

    public testContact(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();
    }
    
    public Account getAt()
    {
        Account[] at = [Select id,name FROM Account where id= :acct.id];
        if(at.size()>0){
    		return at[0];
    	}
    	else{
    		return null;
    	}
    }
            
    public List<Contact> getCntz()
    {
        Account act = [Select id FROM Account where id = :acct.id];
        cntz = [Select id, Name, Client_Potential__c, title, Address_City__c, Direct_Phone__c, Email, Days_Since_Last_Contact__c, Owner.alias, Divisional_Account__c from Contact where ((account.parentid = :act.id OR account.id = :act.id)AND LastName!='Budget')];
    	return cntz;
    }

    public void UpdateRecords() {
        // this simple line of code finds out which column was changed and update the 
        // relevant account record accordingly!
        update cntz;
    }
    
        public void doSort(){
        String order = 'asc';
        
        /*This checks to see if the same header was click two times in a row, if so 
        it switches the order.*/
        if(previousSortField == sortField){
            order = 'desc';
            previousSortField = null;
        }else{
            previousSortField = sortField;
        }
       
        //To sort the table we simply need to use this one line, nice!
        superSort.sortList(cntz,sortField,order);
    }


}

 

 The main purpose of this class is to show all children contacts of a parent account (even if they are attached to a child account of a prent account). Now once I have this list, I would like to sort it (which is why I used the sorting funciton), but somehow this doesnt work. No errors in testing, but just doesnt work as expected!

 

Any help would be much appreciated.

 

Thanks,

Pranav

Hi there,

 

I have the following controller extension, and corresponding unit test. I want to find out why the assertion fails. How do I initialize the controller in the right way, so that the getAt() function sends back the correct account name?

 

extension class:

 

public class childAccount {
    
    private List<Account> acctz;
    private Account acct; 

    public childAccount(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();
    }
    
    public String getAt()
    {
        Account[] at = [Select name FROM Account where id= :acct.id];
    	if(at.size()>0){
    		return at[0].Name;
    	}
    	else{
    		return null;
    	}
    }
            
    public List<Account> getAcctz()
    {
        Account act = [Select id FROM Account where id = :acct.id];
        acctz = [Select id, Name, Address_Street__c, Address_City__c, Office__c, Type, parentid, Ownerid from Account where parentid = :act.id];
    	return acctz;
    }
}

 

test class:

 

@isTest
private class childAccountTest {

    static testMethod void myUnitTest() {    	
    	
    	Account a = new Account(Name='Test Account');
    	
		ApexPages.StandardController sc = new ApexPages.StandardController(a);
		childAccount cont = new childAccount(sc);
		
		system.assertEquals(a.Name,cont.getAt());
    }
}

 

 

 

Does anyone have a work around to remove the "Add to Case" button in Outlook when using Connect for Outlook? All training materials indicate that the visibility of the buttons are standard and they cannot be removed/turned off. We want to be able to remove the buttons we don't use to allow for a clean "roll out". Thank you.