• chrissy2007
  • NEWBIE
  • 25 Points
  • Member since 2007

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

Hi,

I have a trigger that posts a notification to a Chatter Group when an opportunity is Closed Won.  The trigger works, however it always posts TWO duplicate posts at the exact same time.  Below is my code....thoughts on how to fix this?  Thanks!

 

 trigger AddClosedWontoChatter on Opportunity (after update) {

    list<FeedItem> fplist = new list<FeedItem>();
    String opportunityPrefix = Opportunity.SobjectType.getDescribe().getKeyPrefix();

    for(Opportunity o : trigger.new){
        FeedItem fpost= new FeedItem();

         if(o.StageName == 'Closed Won' )
        {
            fpost.type = 'LinkPost';
            fpost.parentid = '0F930000000CbQL';
            fpost.Body = 'RTB 
Alert! Your teammate just Closed Won the $' + o.Invoice_Closed_Won__c + ' opportunity -- ' + o.Name 
            + '\nReason Won Details: ' + o.Reason_Won_Lost_Additional_Details__c;
            fpost.linkUrl = 'https://na1.salesforce.com/' + o.id;
            fpost.title = o.Name + ' - ' + o.Invoice_Closed_Won__c;
            fplist.add(fpost);
        }
    }

    if(fplist.size()!=0){
      try{
         insert fplist;
      }
       catch(system.exception e){
          system.debug('Error: '+e);
      }
    }

Hi everyone,
I actually built a "simplified search" option for our sidebar, and our teams love it!  It is a combination of a visualforce page and javascript. Follow the 4 steps below to do the same.  Hope this helps!

1) Create a Visualforce page called "advancedsearch"
2) Use the following code as your page (Hint: for the "&sen=" portions in bold, these identify the objects you want to search.  For example, &sen=001 is an Account (click on the Accounts tab, and you will see those three numbers in the hyperlink).  My code below searches: Accounts, Opps, Contacts, Leads, and Campaigns

<apex:page showHeader="false" sidebar="false">
<apex:pageBlock >
<b>Enter search term: </b>
<apex:form >
<script>
function doSearch()
{
    var searchStr = document.getElementById('txtSearch').value;
    window.open('/_ui/common/search/client/ui/UnifiedSearchResults?sen=001&sen=003&sen=00Q&sen=006&sen=701&str=' + encodeURIComponent(searchStr), "_parent" );
}
</script>
<input type="text" id="txtSearch"/>
<input type="button" value="Go!" id="btnSearch" onclick="doSearch()"/>
</apex:form>
(<strong>NOTE:</strong> Only searches Accounts, Opps, Contacts, Leads, and Campaigns)
 </apex:pageBlock>
</apex:page>

3) Finally, go to setup > customize > home > home page components.  Create a new HTML area left sidebar component.  On the screen where you can enter in the HTML, make sure you select the checkbox "Show HTML" and then paste the following (this references your visualforce page and displays it in the sidebar):

<IFRAME height=150 src="/apex/advancedsearch?core.apexpages.devmode.url=1" frameBorder=0 width="100%"></IFRAME>

4) Add the custom component to your pagelayouts and test it out! 

Hi,

I have a trigger that posts a notification to a Chatter Group when an opportunity is Closed Won.  The trigger works, however it always posts TWO duplicate posts at the exact same time.  Below is my code....thoughts on how to fix this?  Thanks!

 

 trigger AddClosedWontoChatter on Opportunity (after update) {

    list<FeedItem> fplist = new list<FeedItem>();
    String opportunityPrefix = Opportunity.SobjectType.getDescribe().getKeyPrefix();

    for(Opportunity o : trigger.new){
        FeedItem fpost= new FeedItem();

         if(o.StageName == 'Closed Won' )
        {
            fpost.type = 'LinkPost';
            fpost.parentid = '0F930000000CbQL';
            fpost.Body = 'RTB 
Alert! Your teammate just Closed Won the $' + o.Invoice_Closed_Won__c + ' opportunity -- ' + o.Name 
            + '\nReason Won Details: ' + o.Reason_Won_Lost_Additional_Details__c;
            fpost.linkUrl = 'https://na1.salesforce.com/' + o.id;
            fpost.title = o.Name + ' - ' + o.Invoice_Closed_Won__c;
            fplist.add(fpost);
        }
    }

    if(fplist.size()!=0){
      try{
         insert fplist;
      }
       catch(system.exception e){
          system.debug('Error: '+e);
      }
    }

Hi everyone,
I actually built a "simplified search" option for our sidebar, and our teams love it!  It is a combination of a visualforce page and javascript. Follow the 4 steps below to do the same.  Hope this helps!

1) Create a Visualforce page called "advancedsearch"
2) Use the following code as your page (Hint: for the "&sen=" portions in bold, these identify the objects you want to search.  For example, &sen=001 is an Account (click on the Accounts tab, and you will see those three numbers in the hyperlink).  My code below searches: Accounts, Opps, Contacts, Leads, and Campaigns

<apex:page showHeader="false" sidebar="false">
<apex:pageBlock >
<b>Enter search term: </b>
<apex:form >
<script>
function doSearch()
{
    var searchStr = document.getElementById('txtSearch').value;
    window.open('/_ui/common/search/client/ui/UnifiedSearchResults?sen=001&sen=003&sen=00Q&sen=006&sen=701&str=' + encodeURIComponent(searchStr), "_parent" );
}
</script>
<input type="text" id="txtSearch"/>
<input type="button" value="Go!" id="btnSearch" onclick="doSearch()"/>
</apex:form>
(<strong>NOTE:</strong> Only searches Accounts, Opps, Contacts, Leads, and Campaigns)
 </apex:pageBlock>
</apex:page>

3) Finally, go to setup > customize > home > home page components.  Create a new HTML area left sidebar component.  On the screen where you can enter in the HTML, make sure you select the checkbox "Show HTML" and then paste the following (this references your visualforce page and displays it in the sidebar):

<IFRAME height=150 src="/apex/advancedsearch?core.apexpages.devmode.url=1" frameBorder=0 width="100%"></IFRAME>

4) Add the custom component to your pagelayouts and test it out! 

Hello,

  I have a list button on a custom list view tab which invokes a VF page for mass edit. How can i get an handle on how many records the user has selected in the list view so i can use those records for mass edit in the VF page. I know it's possible to do that as related list button on the detail page.

 

Any help wud be appreciated.

 

 

Thanks,

Anand

Hello guys,

I am trying to achieve the following, i am hoping someone can help me out.

I have created a custom field on my Accounts object called Group. Whenever someone creates a new account i want this field to be populated by the Division name of the user who is now the "Owner" of the Account. The Division name is in the users profile. I can do this with the "Created By' route, but cannot seem to find a way to do this with "Owner".

I was told i might need an S-Control to do this. Can someone pls help me with this?

Thanks!!


Message Edited by SFDC Dev Kallu on 12-05-2008 02:12 PM
Hi all,
 
Our company is just beginning to set up Salesforce and I have a quick question...I have done searches in the forums and help and training and found nothing regarding this...we have .vcf files (Outlook) that we would like to synch with salesforce as LEADS, not contacts. Is there any way to do this? Is there a way to convert contacts into leads in Salesforce?
 
Thanks
Gena Lyon
Hi,

I am constructing a URL with the merge variable $Action.Activity.NewTask, so that when I click it, a new task page is displayed.

I would like to pre-fill as many fields as possibles, by setting field values as URL parameters.

I know about what_id= and who_id= but I could not find other fields that could be explicitly named as a parameter (Subject for example). I scoured the discussion forums and I have found people using <input id=##########  number to successfully set other fields (for example in my custom object, the From field has an <input> id of 00N70000002Fuyw so if I want to prefill 'From' field with the value of foo I send this URL: https://na5.salesforce.com/a02/e?retURL=%2Fa02%2Fo&00N70000002Fuyw=foo

Is there a merge valrable that can get me these ids? Or is there any metadata I could query to get these form field id's? Or am I to inspect the html itself to discover such Id's (as I did in my example above)?

Ciao
Stefano
 
I had a bit of fun building an S-Control using AJAX that shows Contacts with similar email addresses.

I've posted the code on the wiki if anyone is interested. Feedback/suggestions welcome.

John Rotenstein
Sydney, Australia