• bohemianguy100
  • NEWBIE
  • 120 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 152
    Questions
  • 120
    Replies
When a new Chatter user is created from a contact record and the welcome message is sent to the email address of the new Chatter user, it provides a welcome video and then a "Next" button that opens a page with a list of chatter groups you can join.  Is it possible to customize what chatter groups display on that page?  We only want to show certain Chatter groups on that page.  Also, we can't deactivate a Chatter group just so it won't show up in that list.  We need all of the Chatter groups to be active, but want to customize which groups show up on that "next" welcome page from the chatter welcome email.

Thanks.
I've installed the mobileSDK and successfully run the Contact Explorer VFConnector sample apps.  I'm testing if it is possible to use communties for a mobile  app.  I've setup a communitiy, which generates a community login URL.  Is there a way to change the mobile login for the Contact Explorer and/or VF Connector sample apps to point to the community login page?

When I run the sample apps, the default Salesforce login page comes up, which allows you to login to Salesforce and then it will navigate to your Start Page that is specified in the bootconfig.json file.  I'd like to change the login to point to the communities login page instead.  Is this possible?

Thanks.
 I'm new to mobile development, so please excuse any novice quesitons.  I've gone thru some of the online training modules and have a question on actually deploying the app.  If I build my VF pages for mobile, how does the application get installed on the phone and how do the pages get served up to the applicaiton on the phone?  Since the VF pages reside inside of Salesforce, I'm not clear on how those pages get servered to the mobile phone and how the application gets installed on the phone.  I know this is basic stuff, but again, I'm new to mobile development.  I downloaded the SalesforceMobileSDK for Android and setup one of the sample projects in Eclipse.  I have run the application and it starts to run using the emulator in Eclipse that I setup.  However, all the sample code is local on my machine, so if it is within the Salesforce environment, how is it served and deployed to the phone?

Thanks.
 I am running the mobile hybrid application Contact Explorer that is included in the SalesforceMobileSDK-Android source from github.  When I right click on the project and select run as => Android Application, the emulator launches and I can open the ContactExplorer application, which prompts me to login to my Salesforce development org where I setup my connected app information.  However, when I click on fetch contacts or fetch accounts, it shows that I'm skipping frames in the logcat file.  I also see that it does query the records and is retreiving the records, but nothing is showing up in the emulator.  I'm not sure what is wrong and why I don't see the contacts and accounts that I'm fetching from the application.  I'm new to mobile development and haven't been able to resolve the issue.  I'm wondering if it is some memory settings with the emulator?

Is there a better way to test the mobile applications?  Perhaps another tool that I can test from within Eclipse?

Thanks for any help.
I have a SOQL query that is using SUM and Group By, but I need to also get the Id of a field that doesn't use an aggregate function nor is it used in the Group By clause.

select Field1__c, GroupByField__r.Name, SUM(MyField2__c) sumMyField2 from My_SObject__c GROUP BY GroupByField__r.Name

I need to include "Field1__c" in the query to get the ids from that field. Is it possible to include the field without putting it in the Group By clause or using an aggregate function on it?

Thanks for any help.
I have a function that uses a sosl query:

private List<Product2> runSoslToExecute() {
    List<List<Product2>> searchResults = [FIND :query IN ALL FIELDS RETURNING Product2 (Id, Name)];
    List<Product2> results = new List<Product2>();
    for(Product2 p : searchResults[0]) {
        results.add(p);
    }
    return results;
}

If I search for "AB*" then I also get results that include "1AB...". I thought the "*" wildcard only searches in the middle and end of the search and not at the beginning? Is there a way to run the sosl search so it only searches "AB" at the beginning?

Thanks for any help.
I am using a sosl query to search products, but I would like to limit the fields that are searched.  Is there a way to limit what fields are searched?

Here is my method:

private List<Product2> runSoslToExecute() {
  List<List<Product2>> searchResults = [FIND :query IN Name FIELDS RETURNING Product2 (Id, Name, Stock_Number__c, Serial_Number__c, Model__c, Year__c)];
  List<Product2> results = new List<Product2>();
  for(Product2 p : searchResults[0]) {
   results.add(p);
  }
  return results;
}

Thanks for any help.

What is the best way (best practice) to move all of our Salesforce metadata in our full sandbox to production?  Would Eclipse be the best method to do this?  Is there any metadata that Eclipse doesn't take copy?

 

We've had a large team working on numerous areas of Salesforce (configuration and development) and we've promoted all that code to our full sandbox. Before moving to production, we want to backup all the metadata. We are not concerned about actual data. We just want to make sure we backup all the metadata in our full sandbox, then promote to our production instance and finally do a refresh of our full sandbox.

 

We thought about using a change set, but that would be tedious, time-consuming and would it indeed grab all metadata?

 

Would creating an unmanaged package be an option? I've never done anything with packages, so I'm in the dark on that process. Would it be easy to grab all the metadata?

 

I've read about options using the ANT Tool, which I have no experience using and it seems to be a little tricky to setup and configure.

 

I use Eclipse regularly, but does Eclipse grab all the metadata (approval processes, etc.)?  If not, what does it not grab?

 

Thanks for any insight.

I have a list and I need to find if a duplicate value exists in the list and remove both the duplicate value and the original value.

 

I know I can remove the duplicate by using a map or set, but I need to remove the original value as well.

 

For example, if I have a string list:

 

List<String> strings = new List<String>{ 'one', 'two', 'three', 'four', 'one', 'four'};

 

after removing the duplicates and originals I would have:

 

{ 'two', 'three' }

 

Any help is appeciated.

Thanks.

I've been reading several articles on trying to get the picklist values by record type, but I have stumbled on quite what I'm looking for.

 

I'm using the following code in apex to get all record type values:

 

    public List<SelectOption> getShippingMethods() {
        List<SelectOption> options = new List<SelectOption>();
        Schema.DescribeFieldResult fieldResult = Order_Fulfillment__c.Shipping_Method__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        options.add(new SelectOption('', 'Select'));
        for( Schema.PicklistEntry f : ple) {
            options.add(new SelectOption(f.getValue(), f.getLabel()));
        }
        return options;
    }

  Is there a way to filter the piclist values for a specfic record type? 

 

Thanks.

I'm trying to create a formula which calculates the business hours (8am - 5pm) between a task being created and closed.

 

I created a custom "ClosedDate" field on the task object.

 

I found an example online: http://help.salesforce.com/apex/HTViewSolution?id=000089863&language=en_US

 

I tested creating a task today (Oct. 28) and closing it with a date of Oct. 30th.  The number of hours shown the formula field displayed 36 hours.  It should only show the business hours between 8am and 5pm and exclude weekends.  Is there a way to adjust the formula in the link above to accommodate those requirements?

 

Thanks for any help!

Is thee a way to use sosl to query contact records but include the account field in the Find IN ALL Fields?

 

For example, I'm searching by first name, last name and I also want to include account name in the search.  So, if I type in 'Acme', it will find all contact records that are related to the 'Acme' account.

 

Here is the method I'm currently using:

 

    public PageReference contactSearch() {
    	system.debug('***************************** Company' + company);
    	query = firstname + ' ' + lastname + ' ' + company;
		try {
			List<List<Contact>> searchResults = [FIND :query IN ALL FIELDS RETURNING Contact (id, firstname, lastname, Name, account.Name, Personal_Detail_Comments__c, account.BillingStreet, account.BillingCity, account.BillingState, account.BillingPostalCode), Account];	
			resultSetSize = searchResults[0].size();
			for(Contact c : searchResults[0]) {
				contactLinesForPage.add(new ContactWrapper(contactLinesForPage.size(), c, ''));
			}   
		}
		catch(Exception ex) {
			resultSetSize = null;
			ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
            ApexPages.addMessage(msg);
		}
		return null; 	
    }

 

 

Thanks for any help.

Is it possible to query the Salesforce Content object?  I have a need to build a vf page that allows the user to view content records and attach content to a specific contact record.

 

I'm currently trying to query the ContentVersion object and I'm not getting an error, but no content is getting displayed.  I have added one piece of content and am simply trying to return that record in my query.

 

Thanks for any help!

Is there a way to maintain the salesforce UI styles with a custom html table?

 

I am creating an html table:

 

		<table width="100%" cellpadding="5">
			<tr>
				<th>First Name</th>
				<th>Last Name</th>
			</tr>
			<tr>
				<td>{!contact.firstname}</td>
				<td>{!contact.lastname}</td>
			</tr>
		</table>

 I'd like to maintain the salesforce UI styles for this table. 

 

Thanks.

I have a method that returns a Map<Id, List<Id>>

 

Here is the method:

 

private Map<Id, List<Id>> getDbrToAccountMap(Set<Id> dbrIds) {
    Map<Id, List<Id>> dbrAccountMap = new Map<Id, List<Id>>();
    List<Id> accountIds = new List<Id>();
    for(DBR_Group_Member__c member : [select Id, Contact__c, Contact__r.AccountId, DBR__c from DBR_Group_Member__c where DBR__c in: dbrIds]) {
        if(accountIds.isEmpty()) {
            accountIds = new List<Id>();
            dbrAccountMap.put(member.DBR__c, accountIds);
        }
        accountIds.add(member.Contact__r.AccountId);
    }
    return dbrAccountMap;
}

 

I only want to add to the list of accountIds for a unique DBR_c and unique account of the Contact_c

 

For example, if I have a DBR number of:

 

3333 and the contact is John Smith that is on the Acme account (add to the list)

next I have

3333 and the contact is Jane Smith that is on the Acme account (don't add to the list)

next I have

3333 and the contact is Bob Smith that is on the Big Company account (add to the list)

next I have

3333 and the contact is Doug Smith that is on the Big Company account (don't add to the list)

 

The DBR to account should be distinct.

 

In my method, I'm returning the accountIds, but they are not distinct based on the DBR.  I have to be careful because I don't want to remove a duplicate accountId in the list if the DBR number was different.  That would be a valid element in the list.

 

I was thinking instead of returning a Map<Id, List<Id>> I could return a Map<Id, Map<Id, List<Id>>> where the key to the outer map is the DBR__c and the value in the inner map.  The key to the inner map would be the contact and the value would be the list of account ids.  I was trying that, but couldn't get it to work correctly.

 

Any help would be appreciated.

Thanks.

How can I pass parameters to my controller from an iterable component?  I'm using actionSupport with an input checkbox to call an action method in my controller.  I need to pass two values back to the controller that I can reference in my inner class and set the values on two of my properties in the inner class.

 

Here is the relevant section of my VF page:

 

    <apex:pageBlock id="participantBlock">          
        <apex:pageBlockButtons location="top" id="topBtnParticipant">
            <apex:commandButton id="btnParticipant" value="Add Participant" action="{!addParticipant}" reRender="participantTable" />
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Participants" columns="1" id="participantSection">
            <apex:pageBlockTable id="participantTable" value="{!participantLinesForPage}" var="part">
                <apex:column style="white-space:nowrap;text-align:center;" width="4%">
                    <apex:commandLink rerender="participantTable" action="{!deleteParticipant}">
                        <apex:param name="del" value="{!part.iterate}"/>
                        <apex:image id="deleteImage" value="{!URLFOR($Resource.Icons, 'delete.png')}" width="16" height="16"/>
                    </apex:commandLink>
                </apex:column>
                <apex:column headerValue="Contact" width="30%">
                    <apex:inputHidden value="{!part.contactId}" id="targetContactId" />
                    <apex:inputText value="{!part.contactName}" id="targetContactName" onFocus="this.blur()" disabled="false" style="width:175px;" />
                    <a href="#" onclick="openContactLookupPopup('{!$Component.targetContactName}', '{!$Component.targetContactId}', 'userLookupIcon{!part.iterate}', 'accountLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="contactLookupIcon{!part.iterate}" /></a>
                </apex:column>
                <apex:column headerValue="Add Task" width="6%" headerClass="columnAlignment" styleClass="columnAlignment">
                    <apex:inputCheckbox value="{!part.selected}" disabled="{!IF(part.selected == true, true, false)}" >
                        <apex:actionSupport event="onchange" action="{!addTaskFromParticipant}" oncomplete="this.disabled=true;" rerender="taskTable" />
                        <apex:param value="{!part.contactId}" assignTo="{!whoid}" />
                        <apex:param value="{!part.contactName}" assignTo="{!whoname}" />
                    </apex:inputCheckbox>
                </apex:column>
                <apex:column headerValue="User" width="30%">
                    <apex:inputHidden value="{!part.userId}" id="targetUserId" />
                    <apex:inputText value="{!part.userName}" id="targetUserName" onFocus="this.blur()" disabled="false" style="width:175px;" />
                    <a href="#" onclick="openUserLookupPopup('{!$Component.targetUserName}', '{!$Component.targetUserId}', 'contactLookupIcon{!part.iterate}', 'accountLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="userLookupIcon{!part.iterate}" /></a>
                </apex:column>
                <apex:column headerValue="Account" width="30%">
                    <apex:inputHidden value="{!part.accountId}" id="targetAccountId" />
                    <apex:inputText value="{!part.accountName}" id="targetAccountName" onFocus="this.blur()" disabled="false" style="width:175px;" />
                    <a href="#" onclick="openAccountLookupPopup('{!$Component.targetAccountName}', '{!$Component.targetAccountId}', 'contactLookupIcon{!part.iterate}', 'userLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="accountLookupIcon{!part.iterate}" /></a>                  
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>

 

I was trying to use the <apex:param> component and the assignTo attribute.  But, that never fires.

 

When the user selects the checkbox, I want to pass the contactId and contactName for that particular record in the <apex:pageBlockTable> and set it equal to the properties whoid and whoname

 

I can then reference those properties in my inner class and set the values equal to a couple of properties that I have defined in my inner class that is used elsewhere in my VF page.  Is there a way to do this?

 

Thanks for any help.

Regards.

Is there a way to create a lookup field to content on a custom object?  For example, I have a custom object called "Materials Presented", which is the detail object to a custom object "Call Report" that is the master object.  I want to include a lookup field to "Content" on the "Materials Presented" object.  Is this possible?

 

So, a Call Report record can have many Material Presented records that are pointing to different content records. I see no way to create this relationship. 

 

Can anyone help?

 

Thanks.

How can I display the task activity date in the mm/dd/yyyy format on a visualforce page?  I have a custom page with an inputText that uses a DatePickerComponent, that will initially put the date into the correct format...i.e. 8/12/2013.  After saving the record and returning to the page to edit the record, the date is then in the format of: Mon Aug 12 00:00:00 GMT 2013, so if I try and update, it throws the error:

 

Value 'Mon Aug 12 00:00:00 GMT 2013' cannot be converted from Text to Date

 

How can I resolve this issue?

 

Thanks.

I've been reviewing the territory management ERD and trying to get a handle on how to query for the accounts by territory assigned to a specific user.

 

In my controller, I'm using UserInfo.getUserId() to get the userId of the current user.

 

I need to get a list of accounts filtered by territory for that user. 

 

Looking at the ERD, it looks like I need to to query the group table, but the Ids on the group table don't have any matches to the userId, so how do I get the relevant group ids for the specific user? How do I obtain a set of ids for a specific user that can be used to query on the accountShare table that should then return a list of accounts ids that are the accounts by territory for that user? 

 

Am I travesing the objects correctly? I'm missing a relationship somewhere.

 

Thanks for any help.

I'm using the standardSetController to implement pagination in a VF page.  In my controller I have a property totalPages that returns an integer.  The problem is that the value is not rounding up.  For example, if I have a resultSize of 200 and a pageSize of 5, the totalPages should be 40.  If I have a resultSize of 7 and pageSize of 5, the totalPages should be 2.

 

I've been digging thru the math methods trying to get the value to round up correctly.

 

I've tried the following:

 

 

Decimal totalPages = Decimal.valueOf(setCtrl.getResultSize() / setCtrl.getPageSize()).round(RoundingMode.UP);
			return totalPages.intValue();

 It is not rounding up.  Can anyone help with how I can get my totalPages to round up correctly?

 

Thanks for any help.

I'm writing a unit test on the opportunity and opportunity line item.  I am getting the error "No standard price is defined".

 

Here is my test method:

 

public static testMethod void test3() 
    { 
    	Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true);
    	insert pb;
    	Product2 prod = new Product2(Name = 'Anti-infectives 2007', Family = 'Best Practices', Practice__c = 'GP/BP', Service_Level__c = 'Partial Service', Product_Abbrev__c = 'CMR_Antiinfect', Sales_Unit__c = 'Each', Standard_Unit__c = 'Each', Product_Year__c = '07', Item_Type__c = 'Non-Inventory (Sales only)', IsActive = true);
    	insert prod;
    	PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
    	insert pbe;
    	Opportunity opp = new Opportunity(Name = 'Test Syndicated 2010', Type = 'Syndicated - New', StageName = 'Planning', CloseDate = system.today());
    	insert opp;
    	OpportunityLineItem oli = new OpportunityLineItem(opportunityId = opp.Id, pricebookentryId = pbe.Id, Quantity = 1, UnitPrice = 7500, Description = '2007 CMR #4 - Anti-Infectives');
    	insert oli;
		List<OpportunityLineItem> olis = [Select Id From OpportunityLineItem Where OpportunityId =: opp.Id];
		update olis[0];
    }

 

The error is thrown on the line where I try and insert the PricebookEntry record:

 

PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
    	insert pbe;

 

I'm not sure what I'm missing. 

 

Thanks for any help.

Regards.

 

I've installed the mobileSDK and successfully run the Contact Explorer VFConnector sample apps.  I'm testing if it is possible to use communties for a mobile  app.  I've setup a communitiy, which generates a community login URL.  Is there a way to change the mobile login for the Contact Explorer and/or VF Connector sample apps to point to the community login page?

When I run the sample apps, the default Salesforce login page comes up, which allows you to login to Salesforce and then it will navigate to your Start Page that is specified in the bootconfig.json file.  I'd like to change the login to point to the communities login page instead.  Is this possible?

Thanks.
I have a function that uses a sosl query:

private List<Product2> runSoslToExecute() {
    List<List<Product2>> searchResults = [FIND :query IN ALL FIELDS RETURNING Product2 (Id, Name)];
    List<Product2> results = new List<Product2>();
    for(Product2 p : searchResults[0]) {
        results.add(p);
    }
    return results;
}

If I search for "AB*" then I also get results that include "1AB...". I thought the "*" wildcard only searches in the middle and end of the search and not at the beginning? Is there a way to run the sosl search so it only searches "AB" at the beginning?

Thanks for any help.

Is thee a way to use sosl to query contact records but include the account field in the Find IN ALL Fields?

 

For example, I'm searching by first name, last name and I also want to include account name in the search.  So, if I type in 'Acme', it will find all contact records that are related to the 'Acme' account.

 

Here is the method I'm currently using:

 

    public PageReference contactSearch() {
    	system.debug('***************************** Company' + company);
    	query = firstname + ' ' + lastname + ' ' + company;
		try {
			List<List<Contact>> searchResults = [FIND :query IN ALL FIELDS RETURNING Contact (id, firstname, lastname, Name, account.Name, Personal_Detail_Comments__c, account.BillingStreet, account.BillingCity, account.BillingState, account.BillingPostalCode), Account];	
			resultSetSize = searchResults[0].size();
			for(Contact c : searchResults[0]) {
				contactLinesForPage.add(new ContactWrapper(contactLinesForPage.size(), c, ''));
			}   
		}
		catch(Exception ex) {
			resultSetSize = null;
			ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
            ApexPages.addMessage(msg);
		}
		return null; 	
    }

 

 

Thanks for any help.

Is it possible to query the Salesforce Content object?  I have a need to build a vf page that allows the user to view content records and attach content to a specific contact record.

 

I'm currently trying to query the ContentVersion object and I'm not getting an error, but no content is getting displayed.  I have added one piece of content and am simply trying to return that record in my query.

 

Thanks for any help!

How can I pass parameters to my controller from an iterable component?  I'm using actionSupport with an input checkbox to call an action method in my controller.  I need to pass two values back to the controller that I can reference in my inner class and set the values on two of my properties in the inner class.

 

Here is the relevant section of my VF page:

 

    <apex:pageBlock id="participantBlock">          
        <apex:pageBlockButtons location="top" id="topBtnParticipant">
            <apex:commandButton id="btnParticipant" value="Add Participant" action="{!addParticipant}" reRender="participantTable" />
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Participants" columns="1" id="participantSection">
            <apex:pageBlockTable id="participantTable" value="{!participantLinesForPage}" var="part">
                <apex:column style="white-space:nowrap;text-align:center;" width="4%">
                    <apex:commandLink rerender="participantTable" action="{!deleteParticipant}">
                        <apex:param name="del" value="{!part.iterate}"/>
                        <apex:image id="deleteImage" value="{!URLFOR($Resource.Icons, 'delete.png')}" width="16" height="16"/>
                    </apex:commandLink>
                </apex:column>
                <apex:column headerValue="Contact" width="30%">
                    <apex:inputHidden value="{!part.contactId}" id="targetContactId" />
                    <apex:inputText value="{!part.contactName}" id="targetContactName" onFocus="this.blur()" disabled="false" style="width:175px;" />
                    <a href="#" onclick="openContactLookupPopup('{!$Component.targetContactName}', '{!$Component.targetContactId}', 'userLookupIcon{!part.iterate}', 'accountLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="contactLookupIcon{!part.iterate}" /></a>
                </apex:column>
                <apex:column headerValue="Add Task" width="6%" headerClass="columnAlignment" styleClass="columnAlignment">
                    <apex:inputCheckbox value="{!part.selected}" disabled="{!IF(part.selected == true, true, false)}" >
                        <apex:actionSupport event="onchange" action="{!addTaskFromParticipant}" oncomplete="this.disabled=true;" rerender="taskTable" />
                        <apex:param value="{!part.contactId}" assignTo="{!whoid}" />
                        <apex:param value="{!part.contactName}" assignTo="{!whoname}" />
                    </apex:inputCheckbox>
                </apex:column>
                <apex:column headerValue="User" width="30%">
                    <apex:inputHidden value="{!part.userId}" id="targetUserId" />
                    <apex:inputText value="{!part.userName}" id="targetUserName" onFocus="this.blur()" disabled="false" style="width:175px;" />
                    <a href="#" onclick="openUserLookupPopup('{!$Component.targetUserName}', '{!$Component.targetUserId}', 'contactLookupIcon{!part.iterate}', 'accountLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="userLookupIcon{!part.iterate}" /></a>
                </apex:column>
                <apex:column headerValue="Account" width="30%">
                    <apex:inputHidden value="{!part.accountId}" id="targetAccountId" />
                    <apex:inputText value="{!part.accountName}" id="targetAccountName" onFocus="this.blur()" disabled="false" style="width:175px;" />
                    <a href="#" onclick="openAccountLookupPopup('{!$Component.targetAccountName}', '{!$Component.targetAccountId}', 'contactLookupIcon{!part.iterate}', 'userLookupIcon{!part.iterate}'); return false" ><img onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" class="lookupIcon" src="/s.gif" id="accountLookupIcon{!part.iterate}" /></a>                  
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>

 

I was trying to use the <apex:param> component and the assignTo attribute.  But, that never fires.

 

When the user selects the checkbox, I want to pass the contactId and contactName for that particular record in the <apex:pageBlockTable> and set it equal to the properties whoid and whoname

 

I can then reference those properties in my inner class and set the values equal to a couple of properties that I have defined in my inner class that is used elsewhere in my VF page.  Is there a way to do this?

 

Thanks for any help.

Regards.

Is there a way to create a lookup field to content on a custom object?  For example, I have a custom object called "Materials Presented", which is the detail object to a custom object "Call Report" that is the master object.  I want to include a lookup field to "Content" on the "Materials Presented" object.  Is this possible?

 

So, a Call Report record can have many Material Presented records that are pointing to different content records. I see no way to create this relationship. 

 

Can anyone help?

 

Thanks.

How can I display the task activity date in the mm/dd/yyyy format on a visualforce page?  I have a custom page with an inputText that uses a DatePickerComponent, that will initially put the date into the correct format...i.e. 8/12/2013.  After saving the record and returning to the page to edit the record, the date is then in the format of: Mon Aug 12 00:00:00 GMT 2013, so if I try and update, it throws the error:

 

Value 'Mon Aug 12 00:00:00 GMT 2013' cannot be converted from Text to Date

 

How can I resolve this issue?

 

Thanks.

I have a trigger that assigns the account owner to the contact owner record when the contact is inserted or updated (before insert, before update).  I only want to execute code when the account on the contact changes.  If there is no change, I don't want to execute the code.

 

I can compare the account value on the contact using the trigger.new collection and the trigger.oldMap collection.  The code is factored out into a separate class using the trigger template pattern.

 

It is making it a little trickier to do the check and only run the code when the account changes.

 

Here is my class:

 

global class ContactAssignOwnership implements Triggers.HandlerInterface {
	
	Contact[] newCollection = trigger.new;
	Set<Id> accountIds = new Set<Id>();

	
	global void handle() {
		assignContactOwnership(getAccountIds());
	}
	
	private Set<Id> getAccountIds() {
		for(Contact c: newCollection) {
			accountIds.add(c.accountId);
		}
		return accountIds;
	}
	
	private void assignContactOwnership(Set<Id> accountIds) {
		Map<Id, Account> mapAccounts = new Map<Id, Account>([select Id, ownerId from Account where id in: accountIds]);
		
		for(Contact c : newCollection) {
			if(!mapAccounts.isEmpty() && mapAccounts.size() > 0) {
				if(mapAccounts.containsKey(c.accountId)) {
					c.OwnerId = mapAccounts.get(c.accountId).OwnerId;
				}
			}
		}
	}
}

 

I'd like to do the check in the handle method so that I don't run any unnecessary code.  However, how can I accomplish that for bulk?  I need to compare the account values for each record and see if they are different, then call the assignContactOwnership method which has a soql query, so I can't put that method inside a for loop or I'll hit limits.  Also, the oldMap isn't available in the before insert context so I'll get a null pointer exception if I use it there.

 

Any help is appreciated.

Thanks.

I have a VF page that is embedded inline on a custom object page layout section.  In the VF page, I used a command button to redirect to another custom object using the URLFOR New Action.

 

<apex:commandButton onclick="window.parent.location.replace('{!URLFOR($Action.Design__c.New)}');" value="Add Design" rendered="{!IF(designId == null, true, false)}" />

 This works and opens the custom object in the create 'New' record mode.  However, if I click 'Cancel' the retURL opens my VF page directly and not inline on the custom object page layout, which is very bad.  I displays the VF page with no way to get back to the Salesforce UI without hitting the back button.

 

How can I set the retURL probably in the URLFOR method so when the user clicks cancel that it will redirect them back to the correct page?

 

Thanks.

I have a zip file that includes both images and css files that I've uploaded as static resources.

 

In my css file, I have a style rule that references one of the images in the archived as a background image like so:

 

.even{background:transparent url('images/gradient-alt-row.gif') repeat; height:60px;}

 In my visualforce page, I reference the stylesheet like so:

 

<apex:stylesheet value="{!URLFOR($Resource.event,'css/events.css')}"/>

 When I load the page, the background image is not displaying.  I've checked the style rule in Firebug and I can find the style rule, but Firebug indicates that the image failed to load.

 

Does the code above appear incorrect?  I've read the documentation and it shows this is the proper way to reference the image in the css?

 

Has anyone encountered this issue? 

 

Any help is appreciated.

Thanks.

I'm trying to reRender a pageBlockSection.  On the commandButton I'm using the reRender attribute with the id of the pageBlockSection.  The pageBlockSection is not reRendered.

 

Here is a watered down version of the visualforce page with extraneous code removed for brevity.

 

<apex:page standardController="Contact" extensions="ContactExtension" showheader="false" sidebar="false">    
    <apex:outputPanel >
        <apex:pageMessages id="pageMessages"/>
    </apex:outputPanel>
      <apex:form id="theForm">
           <apex:pageBlock mode="maindetail" id="thePageBlock" >
               <apex:pageBlockButtons location="top">                
                    <apex:commandButton action="{!saveContact}" value="Save" reRender="theSection" />
               </apex:pageBlockButtons>             
                <apex:pageBlockSection columns="2" id="theSection">
                    <apex:inputField value="{!contact.Copy_Address__c}" taborderhint="1" >
                        <apex:actionSupport action="{!changeMade}" event="onchange" rerender="pageMessages"  />
                    </apex:inputField>  
                    <apex:inputField value="{!contact.MailingStreet}" id="mailStreet" taborderhint="2">
                        <apex:actionSupport action="{!changeMade}" event="onchange" rerender="pageMessages"  />
                    </apex:inputField>                                                                                
                </apex:pageBlockSection>   
           </apex:pageBlock>   
      </apex:form>                 
</apex:page>

 I seems like the actionSupport on the inputField is someone interferring with the reRender on the commandButton.

 

Any help is appreciated.

Thanks.

Can anyone point me to an example of how to create and assign a territory manually to an account in a unit test?  I have created an account in my unit test, but I also need to manually assign a territory to the account.  So, I need to create the territory, the userTerritory and user record that will be assigned to the account.

 

How do you go about doing this in a unit test.  It doesn't appear you can perform DML on the Territory and UserTerritory objects in a unit test? 

 

Can anyone provide some help on how to accomplish this in a unit test?

 

Thanks.

i have a trigger on a lead that throwing errors due to validation rules.  Is there a good way around this?  It is painful trying to skirt the validation rules when a trigger fires?