• WYam
  • NEWBIE
  • 80 Points
  • Member since 2007

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

I am in need of assistance, any help would be appreciated;


We have a trigger that updates information on Chatter feeds when a product is chaged on an Opportunity Line Item.

 

We are now receiving exception errors due to the governing limit on queries. 

 

The code:

 

trigger LineItemToOpportunityFeedUpdate on OpportunityLineItem (after update) {
    List<FeedPost> posts = new List<FeedPost>();
    Set<Id> pbeIds = new Set<Id>();
    
    for(OpportunityLineItem newOLI : Trigger.new) {
        OpportunityLineItem oldOLI = Trigger.oldMap.get (newOLI.id);
        //System.debug('New: '+newOLI.Part_Outcome__c+' Old: '+oldOLI.Part_Outcome__c);
        
        if(newOLI.Part_Outcome__c != oldOLI.Part_Outcome__c) {
            
            List<OpportunityFeed> opportunityFeedPosts = [SELECT Id, Type, FeedPost.Body
                                                            From OpportunityFeed
                                                            Where ParentID = :newOLI.OpportunityID
                                                            ORDER BY CreatedDate DESC];
                       
            pbeIds.add(newOLI.PricebookEntryId);
            Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>([select Product2.ProductCode from PricebookEntry where id in :pbeIds]);

            pbeIds.add(newOLI.opportunityid);
            Map<Id, Opportunity> Opp = new Map<Id, Opportunity>([select Account.Name, Account.ID from Opportunity where id in :pbeIds]);
                                                                            
            //String bodyText = 'Got here....'+Opp.get(newOLI.OpportunityId).Account.Name+'';                                                               
            String bodyText = 'has updated the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' from '+oldOLI.Part_Outcome__c+' to '+newOLI.Part_Outcome__c+' at '+opp.get(newOLI.OpportunityId).Account.Name+'';    
            
            if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
                //System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);

               
                FeedPost opportunityPost = new Feedpost();
                opportunityPost.Type = 'LinkPost';
                opportunityPost.Title = ''+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' socket details';
                opportunityPost.Body = bodyText;
                String id = String.valueOf(newOLI.Id).substring(0,15);
                opportunityPost.LinkURL = 'https://na2.salesforce.com/'+id;
                opportunityPost.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost);
                System.Debug('Got Here but did not post');
                
                /*@Version 1.3 - removed because I could not get it to display one feedpost with 2 links in the Opportunity Post Title
                FeedPost opportunityPost2 = new FeedPost ();
                opportunityPost2.Type = 'LinkPost';
                opportunityPost2.Title = 'Account Details';
                opportunityPost2.Body = bodyText;
                String id2 = String.valueOf(opp.get(newOLI.OpportunityId).Account.Id).substring(0,15);
                opportunityPost2.LinkURL = 'https://na2.salesforce.com/'+id2;
                opportunityPost2.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost2);
                system.debug('got here and it should have posted twice');
                */
                }
            }
         
        //This section will trigger a feed update to the Opportunity if the Max Potential of any given socket is increased by $1,000,000           
        if(newOLI.Max_Potential__c >= oldOLI.Max_Potential__c + 1000000){
            
            List<OpportunityFeed> opportunityFeedPosts = [Select Id, Type, FeedPost.Body
                                                            From OpportunityFeed
                                                            Where ParentId = :newOLI.OpportunityID
                                                            ORDER BY CreatedDate DESC];
        
            //@1.1 Code that will traverse the Pricebookentry ID and pull back the part number. We could not directly access the part number from the opportunitylineitem.productcode field
            pbeIds.add(newOLI.PricebookEntryId);    
            Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>([select Product2.ProductCode from PricebookEntry 
                                                                            where id in :pbeIds]);
                                                                            
            //Traverse the opportunity object to return the Account detail and get the account name                                                                
            pbeIds.add(newOLI.opportunityid);
            Map<Id, Opportunity> Opp = new Map<Id, Opportunity>([select Account.Name, Account.ID from Opportunity where id in :pbeIds]);                                                                
            
            //Round the dollar values to whole numbers
            decimal NewWholeMaxPotential = newOLI.Max_Potential__c;
            decimal maxpotentialdifference = newOLI.Max_Potential__c/1.0 - oldOLI.Max_Potential__c/1.0;                                                             
            
            String bodyText = 'has increased the Max Potential of the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' by $'+maxpotentialdifference+' at '+opp.get(newOLI.OpportunityId).Account.Name+'';
                                                                                                
        if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
                //System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);
                
                FeedPost opportunityPost = new FeedPost ();
                opportunityPost.Type = 'LinkPost';
                opportunityPost.Title = ''+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' socket details';
                opportunityPost.Body = bodyText;
                String id = String.valueOf(newOLI.id).substring(0,15);
                opportunityPost.LinkURL = 'https://na2.salesforce.com/'+id;
                opportunityPost.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost);
                }    
            }
          
        //This section will update the Chatter feed when the PS3 checkbox is marked true
        //if(newOLI.Socket_Strategy_Required__c == true && oldOLI.Socket_Strategy_Required__C == false){
        if(newOLI.Socket_Strategy_Required__c == true && oldOLI.Socket_Strategy_Required__c == false){  
            List<OpportunityFeed> opportunityFeedPosts = [Select Id, Type, FeedPost.Body
                                                            From OpportunityFeed
                                                            Where ParentId = :newOLI.OpportunityID
                                                            ORDER BY CreatedDate DESC];
                                                      
            pbeIds.add(newOLI.PricebookEntryId);

            Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>([select Product2.ProductCode from PricebookEntry 
                                                                            where id in :pbeIds]);
            
            
            //OppOwnerFirstName = get.FirstName;
            //OppOwnerLastName = get.LastName;
                                                                            
            String bodyText = ' has required a PS3 for the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+'.';                                             
            //String bodyText = ''+opportunity.OwnerId+' has required a PS3 for the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+'.';
            
        if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
                //System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);
                
                FeedPost opportunityPost = new FeedPost ();
                opportunityPost.Type = 'LinkPost';
                opportunityPost.Title = 'Click here for the PS3';
                opportunityPost.Body = bodyText;
                String id = String.valueOf(newOLI.id).substring(0,15);
                opportunityPost.LinkURL = 'https://na2.salesforce.com'+newOLI.PS3_Link__c+'';
                opportunityPost.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost);
                }    
            }*/         
        }
        insert posts;
}

 

Error:

 

Trigger.LineItemToOpportunityFeedUpdate: line 40, column 65

 

 

That line of code is:

 

Map<Id, Opportunity> Opp = new Map<Id, Opportunity>([select Account.Name, Account.ID from Opportunity where id in :pbeIds]);

 I know that the query should be outside the for loop and please understand that I am still fairly new to APEX. 

 

Where can I place these queries and still have this trigger work as designed.

 

Thanks to anyone in advance!!

 

~Mike

Can a user with read-ony privilege "follow" the record in Chatter? More importantly can the user with Read Only access to the record actively participate in the Chatter on the record - sort of like a discussion board?

I need to prevent users from entering start dates that are less than the current month and year.

 

Thank you in advance

  • February 25, 2010
  • Like
  • 0

Hi there and thank you for taking the time to read this post.

 

We are using the standard <apex:dataTable> to create a list of records and display them in columns.

 

Three of the columns are currency fields and we're wondering if there's a way to put in the sums of those columns a the bottom of the table similiar the the screenshot:

 

 

 

Any help you can provide is much appreciated.

 

 

Cheers,

Will

  • March 07, 2011
  • Like
  • 0

Hey there and thank you for reading this.

 

I have a VForce page that uses a standard controller from a detail record.

 

I'm trying to access details of the Master record from this Detail record but I'm having trouble. I've been able to go the other (from master to detail). Here is the code snippet for that:

 

 

<apex:page standardController="Budget__c" showHeader="false" sidebar="false">  
.
.
.
<apex:dataTable value="{!Budget__c.Budget_Products__r}" var="bprod" cellPadding="5" border="1"> 
.
.
.
.


 

 

I can't figure out how to go the other way or whether or not it's even possible:

 

<apex:page standardController="Budget_Product__c" showHeader="false" sidebar="false">
.
.
.
<apex:param value="{!Budget_product__c.Budgets__r.Name}" />
.
.
.

 

This may or may not be clear. Again thank you for your help and any insight you can provide.

 

 

Cheers,

Will

 

 

  • February 04, 2011
  • Like
  • 0

Hey everyone! Starting to work a little bit using triggers in Salesforce relative to Chatter.

 

Business Case:

We are trying to update the chatter feed of the Opportunity when a change to a specific field is made. Ideally, we'd like to post the following in the chatter post details.

 

<OpportunityLineItem Link> -- <Account Link>

 

 

Here is the snippet of code that we're working with now:

 

            if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
//System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);

FeedPost opportunityPost = new FeedPost ();
opportunityPost.Type = 'LinkPost';
opportunityPost.Title = ''+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' socket details';
opportunityPost.Body = bodyText;
String id = String.valueOf(newOLI.Id).substring(0,15);
opportunityPost.LinkURL = 'https://cs2.salesforce.com/'+id;
opportunityPost.ParentID = newOLI.opportunityid;
posts.add(opportunityPost);
System.Debug('Got Here but did not post');

FeedPost opportunityPost2 = new FeedPost ();
opportunityPost2.Type = 'LinkPost';
opportunityPost2.Title = 'Account Details';
opportunityPost2.Body = bodyText;
String id2 = String.valueOf(opp.get(newOLI.OpportunityId).Account.Id).substring(0,15);
opportunityPost2.LinkURL = 'https://cs2.salesforce.com/'+id2;
system.debug('got here and it should have posted twice');
opportunityPost2.ParentID = newOLI.opportunityid;
posts.add(opportunityPost2);

 

 

The Result:

 

We get two posts where the message title is the same but the post bodies are different. Essentially we get a double post with each having a unique link for one to the opportunitylineitem and the other to the account.

 

Any help or quesitons are greatly appreciated!

 

 

  • April 26, 2010
  • Like
  • 0
 I created a field in the Opportunity object that held a picklist value. The value in that field is supposed to update with a workflow rule and remain blank until the rule triggers.

Absentmindedly, I put in a default picklist value that has now populated over 1,500 records with a picklist value even though the rule criteria has not been met. Needless to say, this is wrecking havoc on our data sets.

I tried to use the dataloader to update the field value with no value to no sucess. If I leave the field value blank, the existing value remains in the field. If I use "NULL" the word "NULL" is inserted into the field.

Any thoughts on how I can get around to deleting these field values without running through the 1,500 records?

Thanks!
  • August 31, 2007
  • Like
  • 0

Hi,

 

Does anyone have any interesting thoughts on the old conundrum of making sure that Opportunities don't get edited after close?  Even if they do get edited for certain reasons, most businesses would not want opportunity products deleted after opportunities are closed.

 

I've always changed the record type on closed opps and assigned a read-only page layout.  This still allows for line items to be deleted.    This doesn't work so well anymore as I've got too many record types that would need corresponding "Closed" record types.

 

I've been considering:

 

1. Using Approvals to lock the record

2. Using a trigger to throw an error

 

Are there any other interesting ways you all go about this?  Maybe some validation rule I wasn't thinking of??

 

I've read other posts on this topic, but they're many years old.

Hi,

I am creating an AccountShare object.

I am logged in as System Administrator while doing so.

 

But still I am getting following error : INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY insufficient access rights on cross-reference id: []:

 

Any suggestion what might be wrong?

Hey there and thank you for reading this.

 

I have a VForce page that uses a standard controller from a detail record.

 

I'm trying to access details of the Master record from this Detail record but I'm having trouble. I've been able to go the other (from master to detail). Here is the code snippet for that:

 

 

<apex:page standardController="Budget__c" showHeader="false" sidebar="false">  
.
.
.
<apex:dataTable value="{!Budget__c.Budget_Products__r}" var="bprod" cellPadding="5" border="1"> 
.
.
.
.


 

 

I can't figure out how to go the other way or whether or not it's even possible:

 

<apex:page standardController="Budget_Product__c" showHeader="false" sidebar="false">
.
.
.
<apex:param value="{!Budget_product__c.Budgets__r.Name}" />
.
.
.

 

This may or may not be clear. Again thank you for your help and any insight you can provide.

 

 

Cheers,

Will

 

 

  • February 04, 2011
  • Like
  • 0

Hi developers,

 

please solve my problem................

 

i am getting decimal output, i dont need only i will display number without decimal

what change i need to do?

NO. of items:<apex:outputPanel ><apex:inputField style="width:100px;" value="{!items.item1__c}" </apex:outputPanel>

 

this is sample code to convert number format with decimal points

<apex:page standardController="Account">
It is worth:
<apex:outputText value="{0, number, 000,000.00}">
       <apex:param value="{!Account.AnnualRevenue}" />
 </apex:outputText>
</apex:page>


                         

I am in need of assistance, any help would be appreciated;


We have a trigger that updates information on Chatter feeds when a product is chaged on an Opportunity Line Item.

 

We are now receiving exception errors due to the governing limit on queries. 

 

The code:

 

trigger LineItemToOpportunityFeedUpdate on OpportunityLineItem (after update) {
    List<FeedPost> posts = new List<FeedPost>();
    Set<Id> pbeIds = new Set<Id>();
    
    for(OpportunityLineItem newOLI : Trigger.new) {
        OpportunityLineItem oldOLI = Trigger.oldMap.get (newOLI.id);
        //System.debug('New: '+newOLI.Part_Outcome__c+' Old: '+oldOLI.Part_Outcome__c);
        
        if(newOLI.Part_Outcome__c != oldOLI.Part_Outcome__c) {
            
            List<OpportunityFeed> opportunityFeedPosts = [SELECT Id, Type, FeedPost.Body
                                                            From OpportunityFeed
                                                            Where ParentID = :newOLI.OpportunityID
                                                            ORDER BY CreatedDate DESC];
                       
            pbeIds.add(newOLI.PricebookEntryId);
            Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>([select Product2.ProductCode from PricebookEntry where id in :pbeIds]);

            pbeIds.add(newOLI.opportunityid);
            Map<Id, Opportunity> Opp = new Map<Id, Opportunity>([select Account.Name, Account.ID from Opportunity where id in :pbeIds]);
                                                                            
            //String bodyText = 'Got here....'+Opp.get(newOLI.OpportunityId).Account.Name+'';                                                               
            String bodyText = 'has updated the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' from '+oldOLI.Part_Outcome__c+' to '+newOLI.Part_Outcome__c+' at '+opp.get(newOLI.OpportunityId).Account.Name+'';    
            
            if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
                //System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);

               
                FeedPost opportunityPost = new Feedpost();
                opportunityPost.Type = 'LinkPost';
                opportunityPost.Title = ''+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' socket details';
                opportunityPost.Body = bodyText;
                String id = String.valueOf(newOLI.Id).substring(0,15);
                opportunityPost.LinkURL = 'https://na2.salesforce.com/'+id;
                opportunityPost.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost);
                System.Debug('Got Here but did not post');
                
                /*@Version 1.3 - removed because I could not get it to display one feedpost with 2 links in the Opportunity Post Title
                FeedPost opportunityPost2 = new FeedPost ();
                opportunityPost2.Type = 'LinkPost';
                opportunityPost2.Title = 'Account Details';
                opportunityPost2.Body = bodyText;
                String id2 = String.valueOf(opp.get(newOLI.OpportunityId).Account.Id).substring(0,15);
                opportunityPost2.LinkURL = 'https://na2.salesforce.com/'+id2;
                opportunityPost2.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost2);
                system.debug('got here and it should have posted twice');
                */
                }
            }
         
        //This section will trigger a feed update to the Opportunity if the Max Potential of any given socket is increased by $1,000,000           
        if(newOLI.Max_Potential__c >= oldOLI.Max_Potential__c + 1000000){
            
            List<OpportunityFeed> opportunityFeedPosts = [Select Id, Type, FeedPost.Body
                                                            From OpportunityFeed
                                                            Where ParentId = :newOLI.OpportunityID
                                                            ORDER BY CreatedDate DESC];
        
            //@1.1 Code that will traverse the Pricebookentry ID and pull back the part number. We could not directly access the part number from the opportunitylineitem.productcode field
            pbeIds.add(newOLI.PricebookEntryId);    
            Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>([select Product2.ProductCode from PricebookEntry 
                                                                            where id in :pbeIds]);
                                                                            
            //Traverse the opportunity object to return the Account detail and get the account name                                                                
            pbeIds.add(newOLI.opportunityid);
            Map<Id, Opportunity> Opp = new Map<Id, Opportunity>([select Account.Name, Account.ID from Opportunity where id in :pbeIds]);                                                                
            
            //Round the dollar values to whole numbers
            decimal NewWholeMaxPotential = newOLI.Max_Potential__c;
            decimal maxpotentialdifference = newOLI.Max_Potential__c/1.0 - oldOLI.Max_Potential__c/1.0;                                                             
            
            String bodyText = 'has increased the Max Potential of the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' by $'+maxpotentialdifference+' at '+opp.get(newOLI.OpportunityId).Account.Name+'';
                                                                                                
        if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
                //System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);
                
                FeedPost opportunityPost = new FeedPost ();
                opportunityPost.Type = 'LinkPost';
                opportunityPost.Title = ''+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' socket details';
                opportunityPost.Body = bodyText;
                String id = String.valueOf(newOLI.id).substring(0,15);
                opportunityPost.LinkURL = 'https://na2.salesforce.com/'+id;
                opportunityPost.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost);
                }    
            }
          
        //This section will update the Chatter feed when the PS3 checkbox is marked true
        //if(newOLI.Socket_Strategy_Required__c == true && oldOLI.Socket_Strategy_Required__C == false){
        if(newOLI.Socket_Strategy_Required__c == true && oldOLI.Socket_Strategy_Required__c == false){  
            List<OpportunityFeed> opportunityFeedPosts = [Select Id, Type, FeedPost.Body
                                                            From OpportunityFeed
                                                            Where ParentId = :newOLI.OpportunityID
                                                            ORDER BY CreatedDate DESC];
                                                      
            pbeIds.add(newOLI.PricebookEntryId);

            Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>([select Product2.ProductCode from PricebookEntry 
                                                                            where id in :pbeIds]);
            
            
            //OppOwnerFirstName = get.FirstName;
            //OppOwnerLastName = get.LastName;
                                                                            
            String bodyText = ' has required a PS3 for the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+'.';                                             
            //String bodyText = ''+opportunity.OwnerId+' has required a PS3 for the '+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+'.';
            
        if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
                //System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);
                
                FeedPost opportunityPost = new FeedPost ();
                opportunityPost.Type = 'LinkPost';
                opportunityPost.Title = 'Click here for the PS3';
                opportunityPost.Body = bodyText;
                String id = String.valueOf(newOLI.id).substring(0,15);
                opportunityPost.LinkURL = 'https://na2.salesforce.com'+newOLI.PS3_Link__c+'';
                opportunityPost.ParentID = newOLI.opportunityid;
                posts.add(opportunityPost);
                }    
            }*/         
        }
        insert posts;
}

 

Error:

 

Trigger.LineItemToOpportunityFeedUpdate: line 40, column 65

 

 

That line of code is:

 

Map<Id, Opportunity> Opp = new Map<Id, Opportunity>([select Account.Name, Account.ID from Opportunity where id in :pbeIds]);

 I know that the query should be outside the for loop and please understand that I am still fairly new to APEX. 

 

Where can I place these queries and still have this trigger work as designed.

 

Thanks to anyone in advance!!

 

~Mike

Can a user with read-ony privilege "follow" the record in Chatter? More importantly can the user with Read Only access to the record actively participate in the Chatter on the record - sort of like a discussion board?

Hey everyone! Starting to work a little bit using triggers in Salesforce relative to Chatter.

 

Business Case:

We are trying to update the chatter feed of the Opportunity when a change to a specific field is made. Ideally, we'd like to post the following in the chatter post details.

 

<OpportunityLineItem Link> -- <Account Link>

 

 

Here is the snippet of code that we're working with now:

 

            if(opportunityFeedPosts.size() == 0 || opportunityFeedPosts[0].FeedPost.Body != bodyText) {
//System.debug('OpportunityFeed Posts: '+opportunityFeedPosts[0]);

FeedPost opportunityPost = new FeedPost ();
opportunityPost.Type = 'LinkPost';
opportunityPost.Title = ''+entries.get(newOLI.Pricebookentryid).Product2.ProductCode+' socket details';
opportunityPost.Body = bodyText;
String id = String.valueOf(newOLI.Id).substring(0,15);
opportunityPost.LinkURL = 'https://cs2.salesforce.com/'+id;
opportunityPost.ParentID = newOLI.opportunityid;
posts.add(opportunityPost);
System.Debug('Got Here but did not post');

FeedPost opportunityPost2 = new FeedPost ();
opportunityPost2.Type = 'LinkPost';
opportunityPost2.Title = 'Account Details';
opportunityPost2.Body = bodyText;
String id2 = String.valueOf(opp.get(newOLI.OpportunityId).Account.Id).substring(0,15);
opportunityPost2.LinkURL = 'https://cs2.salesforce.com/'+id2;
system.debug('got here and it should have posted twice');
opportunityPost2.ParentID = newOLI.opportunityid;
posts.add(opportunityPost2);

 

 

The Result:

 

We get two posts where the message title is the same but the post bodies are different. Essentially we get a double post with each having a unique link for one to the opportunitylineitem and the other to the account.

 

Any help or quesitons are greatly appreciated!

 

 

  • April 26, 2010
  • Like
  • 0
I have created a custom object. As per the documentation, to create a trigger it says go to Setup | Create | Objects. When I go to the triggers section there is no "new" button??? How do you create a trigger please? 

i have an old post on here (http://community.salesforce.com/sforce/board/message?board.id=custom_formula&message.id=4416)

where I was attempting to add 1 or 2 months to a date.  For instance, if my date was 3/4/2010, I wanted to be able to add one month and get 4/4/2010. 

 

there was a link to a page (successforce i think) that had a series of formulas that would allow me to do this.  however, i need to be able to access this page again and it's gone. 

 

does anyone know where this page is, or if there is an easier way to accomplish this now?

 

thanks,

miss v

  • March 04, 2010
  • Like
  • 0

I was not sure where to post this so I am sorry if this is the wrong area.  I need some ideas on what the best solution would be.

 

We want to alert a user when they view an opportunity if the CloseDate is less than today and do not know the best way to go about it.

 

Could someone please give me an idea or an example of where this is done.

 

I hope this makes sense

 

~Mike 

Guys,

I have created a "NEW Page Layout" for Contact Object cloning it from an existing page layout. Removed "ABC Section" and added "New Section" in the "NEW Page Layout".I have created new fields in the NEW Section . Then I assigned this new page layout to a "NEW Profile". So when a user from this NEW Profile logs in, the user views the NEW Page Layout including the New Section. This is fine. Now,when the User(NEW Profile) clicks on EDIT button in the contact, the user views the "ABC Section" instead of the 'NEW Section', which is weird. The User must be able to edit the fields in New Section.

Can anyone help me fix this issue ??
We've created a Custom Case Button (URL) that's available from Case Related Lists on our Custom Product Details Page.  

/500/e?cas3={!CustomProduct__c.Customer_Account__c}&cas3_lkid={!CustomProduct__c.Customer_AccountId__c}&retURL=%2F{!CustomProduct__c.Customer_AccountId__c}

It's pre-populating the Contact Info into the Case just fine, but when we click Save the following error is displayed: 

 

Unable to Access Page
Invalid parameter value "Bob Jones" for parameter "cas3". 

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. 
 
We use 'Person Accounts' in our implementation and I'm concerned that might be causing our issue here, but the fact that it pre-populates just fine makes me wonder.  Any other ideas of what might be going wrong here?  Thanks!

I want to create a field to reflect the last time an Opportunity was changed (by modificication or an activity). I wrote the following formula and used a return type of date:

 

IF( LastModifiedDate  >  LastActivityDate,  LastModifiedDate, LastActivityDate )

 

But I am getting this error message and I can't figure out how to work around it. Any help would be much appreciated.

 

Error: Incorrect parameter for function >(). Expected DateTime, received Date

  • March 02, 2010
  • Like
  • 0

I am working on triggering a workflow to create a task after a lead has been around for 7 days. So far I have

 

 

OR(ispickval(Status,"Open"),ispickval(Status,"Contact Made"),ispickval(Status,"Contact Attempted")) && today() - datevalue(CreatedDate) = 7

 

 

 

But the workflow isnt triggering, is there anyway to make this happen without doing a time-dependent workflow?

 

I have figured out I cannot trigger a workflow off of a forumula field.

 

How can i get this accomplished?

 

Is it possible to do a formula using ischanged on a formula field and then check that same field if it equals 7 to trigger the workflow?

Message Edited by jjfdev on 03-01-2010 02:59 PM
Message Edited by jjfdev on 03-01-2010 03:19 PM
Message Edited by jjfdev on 03-01-2010 03:34 PM
  • March 01, 2010
  • Like
  • 0

Hello, Could someone please help me with this formula:

 

IF(
         AND ( Stage_Duration__c  > 1,
IF(ISPICKVAL( Job_Status__c , "Work to be Scheduled"), "-= OVER DUE =-"

 

 

I have two fields "Stage Duration" and "Job Status" I want the "Over due" message to appear when Stage duration is >1 and Job_Status = Work to be Scheduled.

 

Thanks in advance.

  • February 25, 2010
  • Like
  • 0

Is their a way to create a formula that would do the following:

 

When on the opportunity page Save is it hit, can a box pop up asking if the opportunity is a deal to close (which is a checkbox on the page)?

 

My sales staff always forgets to check the box so a reminder would be great.

 

Thanks to anyone who could help!

I want to create a button on the opportunity page that creates a special kind of task "Request Contract". I want it to assign the task to a particular individual and link it to the opportunity. So far, I've been able to create the task and assign it to a particular person.

 

However, I can't figure out how to link it to the opportunity. Or rather, I can't figure out how to pass the opportunity's ID to the task. Everything I've tried just results in an error message. Even when I insert the opportunity ID from the "insert merge field" drop down box, the button doesn't work.

 

Can somebody help with this?

 

Thanks in advance.

 

J.

 

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js" )}
{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js" )}

var t1= new sforce.SObject("Task" );
t1.OwnerId = "00530000001itnL";//SFDC ID of user record
t1.Subject = "Requesting Contract";
t1.Status = "Not Started";
t1.Priority = "Normal";
t1.What = {!Opportunity.Id}

result = sforce.connection.create([t1]);

  • February 19, 2010
  • Like
  • 0