• Ross Gilbert 18
  • NEWBIE
  • 40 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
Hey all, This is probably silly but I can't figure it out.

I'm trying to create a formula field (Contract Term in months) to get number (of months) a contract is, by subtracting my Subscription End Date custom date field from my Subscription Start Date custom field.

This isn't working:  DATEVALUE(Pilot_Start_Date__c) - DATEVALUE(Pilot_End_Date__c)
Error: Incorrect argument type for function 'DATEVALUE()'.

Can anybody help?  Thanks a million!

Kelly
This trigger simply prevents a user from inserting a record on an object.  It's not bulkified since the whole point is to prevent any record from being inserted at all.   It works fine but I wanted to check with the community to see if anyone sees anything wrong with the code or if it might be improved:
 
trigger FeedItemTrigger on FeedItem(Before Insert){

    /*Ross Gilbert 6/9/2015: The following prevents a Salesforce user from inserting any new Feed Item object in Salesforce*/
 
    for(FeedItem fi: trigger.new){
        fi.addError('Chatter is not currently supported for Salesforce.  You are not allowed to create new chatter posts or comments at this time.');
    }
}
What do you think?
 
This trigger simply prevents a user from inserting a record on an object.  It's not bulkified since the whole point is to prevent any record from being inserted at all.   It works fine but I wanted to check with the community to see if anyone sees anything wrong with the code or if it might be improved:
 
trigger FeedItemTrigger on FeedItem(Before Insert){

    /*Ross Gilbert 6/9/2015: The following prevents a Salesforce user from inserting any new Feed Item object in Salesforce*/
 
    for(FeedItem fi: trigger.new){
        fi.addError('Chatter is not currently supported for Salesforce.  You are not allowed to create new chatter posts or comments at this time.');
    }
}
What do you think?
 
I need to add multiple date ranges to my trigger below or maybe create a apex class to perform this function.
I have two objects Unit__c & Warranty__c . There are date fields on both object (Unit__c, ShipDateForm__c) (Warranty__c, WrntyStartDate__c).
I need my trigger or apex class to compare the ShipDateForm__c and the WrntyStartDate__c. can I do a IF statement with 3 conditions, because i need to check another field to.
This is what it looks like below, but it doesn't work.  Any help would be appreciated

CODE SNIPPET:

if (newUnit .Warranty_Type__c == null && newUnit .ShipDateForm__c <= '2011-12-30' && newUnit .WrntyStartDate__c <= '2011-12-30' ) {
      Warranty__c product = wrntyMap.get(newUnit.Product__c);


FULL TRIGGER:

trigger Trigger_UpdateWarranties on Unit__c (before insert, before update ) {

// Step 1: Create a set of all products of Units to query
  Set<String> allwrnty = new Set<String>();
 
for (Unit__c newUnit : Trigger.new) {
    if (newUnit.Product__c != null) {
      allwrnty.add(newUnit.Product__c);    }
  }

  // Step 2: Query for all the Units in Step 1
  List<Warranty__c> potentialproduct = [SELECT Id, Name,Warranty_Active_Date__c, Product__c FROM Warranty__c
                                 WHERE Product__c IN :allwrnty];

 
   // Step 3: Make a Map that lets you search for units by product
  Map<String, Warranty__c> wrntyMap = new Map<String, Warranty__c>();
  for (Warranty__c w : potentialproduct) {
    wrntyMap.put(w.Product__c, w);
  }
 // Step 4: Get the matching Warranty in the Map by product!
  for (Unit__c newUnit : Trigger.new) {
   
  if (newUnit .Warranty_Type__c == null && newUnit .ShipDateForm__c <= '2011-12-30' && newUnit .WrntyStartDate__c <= '2011-12-30' ) {
      Warranty__c product = wrntyMap.get(newUnit.Product__c);
      
       
     
      if (product != null) {
        newUnit.Warranty_Type__c = product.Id;
      }
    }
  }
    
 
    }
  • April 22, 2015
  • Like
  • 0
I have been trying to build a Flow that would update a Lookup Field on a Lead record if the criteria on the Lead and the criteria on another Object match. However, everytime I run the test against different Lead records, the flow returns the same results as the 1st initial test I ran from day 1.

Example:

If Lead email domain = Account Domain, Update X field on the Lead record

How it Should work:

Lead 1
Account Domain 1
Update Field is Account 1

Lead 2
Account Domain 2
Update Field is Account 2

How it is currently working:

Lead 1
Account Domain 1
Update Field is Account 1

Lead 2
Account Domain 1
Update Field is Account 1

(Flow Screen Shot below)

For some reason, the flow does not want to understand anything outside of the 1st initial Account Domain. Any thoughts as to what I may be doing wrong?

User-added image
 
Hey all, This is probably silly but I can't figure it out.

I'm trying to create a formula field (Contract Term in months) to get number (of months) a contract is, by subtracting my Subscription End Date custom date field from my Subscription Start Date custom field.

This isn't working:  DATEVALUE(Pilot_Start_Date__c) - DATEVALUE(Pilot_End_Date__c)
Error: Incorrect argument type for function 'DATEVALUE()'.

Can anybody help?  Thanks a million!

Kelly
Hi
I cant seem to find any way to add a column to the activity history panel on a record that will display the comments (or at least the first few words of the comments) from the comments field of the call or activity the hostory relates to.
The whole point of a good CRM is to view the activity history itself over the recent activities not a list of links to other pages where the actual history resides!