• deep12us
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

The standard salesforce page is in a Iframe. I want no sidebar to be shown on the page with recent items. I tried disabling the option from user interface in setup, but didn't work. Is there anyway or code to do that.

Hi, I was writing testcases for a trigger which keeps user and contact in sync, if users exists.

I'm creating a new contact , user and account  and inserting each of these objects But it gives me the error

assertion failed for email as I'm using system.asserteauals(contact.email, user.email)

Below is the code

 

@isTest
private class PL_ContactUserSyncControllerTest 
{
 static testMethod void ControllerShouldNotBeNULL() 
 {
 PL_ContactUserSyncController controller = new PL_ContactUserSyncController();
 system.assertNotEquals(controller, NULL);
    }
    static testMethod void ControllerContactUserSyncForOneUser()
 {

Contact c1 = new Contact();
c1 = insertContact();
User u1 = insertUser();
Contact c2 = [Select Email,Id from Contact where Id=:c1.Id];
c2.Email = 'me@catch.com';
update c2;
Contact c1u = [Select Email from Contact where Id=:c2.Id];
User u1u = [Select Email from User where Id=:u1.Id];
system.assertEquals(c1u.Email, u1u.Email);
system.debug(u1u.Email+ ' '+c1u.Email);
    }
    static Contact insertContact() 
{
Contact c1 = new Contact();
c1.AccountId = '001T000000Vk4ZzIAJ';
c1.FirstName = 'catch';
c1.LastName = 'me';
c1.Email = 'catch@me.com';
c1.Preferred_Language__c = 'English';
insert c1;
return c1;
}
static User insertUser()
{
Contact c = insertContact();
Profile p1 = [Select Id from profile where Id='00e60000000idGFAAY' limit 1];
UserRole r1 = [Select Id from UserRole where Id='00ET0000000rtysMAA' limit 1];
User u1 = new User();
u1.FirstName = c.FirstName;
u1.LastName = c.LastName;
u1.Username = 'catch@me.com';
u1.Language__c = 'English';
u1.ContactId = c.Id;
u1.Email = 'catch1@me.com';
u1.Alias = 'meu';
u1.TimeZoneSidKey = 'America/Los_Angeles';
u1.LocaleSidKey = 'en_US';
u1.EmailEncodingKey = 'ISO-8859-1';
u1.ProfileId = p1.Id;
u1.LanguageLocaleKey = 'en_US';
u1.UserRoleId = r1.Id;
u1.PortalRole = 'Worker';
insert u1;
return u1;
}
}

 

Is there any way to use custom columns in enhanced lists.

I was trying to create a column in enhanced list view and I've to populate the column with a button, if it meets the condition specified

Please do reply

Thanks

Hi, I was writing testcases for a trigger which keeps user and contact in sync, if users exists.

I'm creating a new contact , user and account  and inserting each of these objects But it gives me the error

assertion failed for email as I'm using system.asserteauals(contact.email, user.email)

Below is the code

 

@isTest
private class PL_ContactUserSyncControllerTest 
{
 static testMethod void ControllerShouldNotBeNULL() 
 {
 PL_ContactUserSyncController controller = new PL_ContactUserSyncController();
 system.assertNotEquals(controller, NULL);
    }
    static testMethod void ControllerContactUserSyncForOneUser()
 {

Contact c1 = new Contact();
c1 = insertContact();
User u1 = insertUser();
Contact c2 = [Select Email,Id from Contact where Id=:c1.Id];
c2.Email = 'me@catch.com';
update c2;
Contact c1u = [Select Email from Contact where Id=:c2.Id];
User u1u = [Select Email from User where Id=:u1.Id];
system.assertEquals(c1u.Email, u1u.Email);
system.debug(u1u.Email+ ' '+c1u.Email);
    }
    static Contact insertContact() 
{
Contact c1 = new Contact();
c1.AccountId = '001T000000Vk4ZzIAJ';
c1.FirstName = 'catch';
c1.LastName = 'me';
c1.Email = 'catch@me.com';
c1.Preferred_Language__c = 'English';
insert c1;
return c1;
}
static User insertUser()
{
Contact c = insertContact();
Profile p1 = [Select Id from profile where Id='00e60000000idGFAAY' limit 1];
UserRole r1 = [Select Id from UserRole where Id='00ET0000000rtysMAA' limit 1];
User u1 = new User();
u1.FirstName = c.FirstName;
u1.LastName = c.LastName;
u1.Username = 'catch@me.com';
u1.Language__c = 'English';
u1.ContactId = c.Id;
u1.Email = 'catch1@me.com';
u1.Alias = 'meu';
u1.TimeZoneSidKey = 'America/Los_Angeles';
u1.LocaleSidKey = 'en_US';
u1.EmailEncodingKey = 'ISO-8859-1';
u1.ProfileId = p1.Id;
u1.LanguageLocaleKey = 'en_US';
u1.UserRoleId = r1.Id;
u1.PortalRole = 'Worker';
insert u1;
return u1;
}
}

 

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