Ask Search:
Rebecca BrownRebecca Brown 
Hello!
I work at a youth center where we need to know if a youth has "aged out" of the program (we serve up to 24 years old).  How do I create a formula that will check the box if a youth's birthday is 25 years before the current date (not today, but whatever the current date is at the time)?  I already created a checkbox field called aged_out__c, but I need the formula using the "Birthdate" field.

Thank you!!!
Best Answer chosen by Rebecca Brown
Steve MolisSteve Molis
Here you go

Custom Field
Datatype = Formula
Result = Checkbox
Formula =
BirthDate < ADDMONTHS( TODAY() , - ( 25 * 12 ) )

 
Rachana ChaudhariRachana Chaudhari 
Hi 
I  am looking for some help/suggestions on how to debug my Process with auto launch flow, which works in one scenario but not in the other. Here is the scenario:
 
We need to record the date when the last activity of any form was done with a contact. Since the standard field last activity date, does not work for us, I added a custom date field "Last Contact Date" on contact object and created two processes on Task and emailmessage object each to populated this field.
 
The process on task works fine and populates "Last Contact Date" when a task is completed.
 
The process on emailmessage object works fine in one scenario, but not in the second and I am not able to debug why. Here is the logic for email object.
 
The process fires when a new outgoing emailmessage  record is created. Retrieves the "To Address" from the record and launches a flow. Flow searches for the contact by matching the "To Address" from emailmessage with contact's email address and stamps the date on the contact record found. Email on contact is unique for each contact.
 
This process+Flow works fine when I send email out from Salesforce and the contact is stamped with correct date.
 
We do have Outlook integration. When email is sent out from Outlook and is logged on the contact record, this process+flow does not seem to work. I see the email logged on the contact, but the custom field "Last Contact Date " is not populated. I do see a new emailmessage record is created which is outbound and has "To Address" populated, but for some reason the Last contact date on the contact remains blank. I am not sure if the process is not firing, or if the flow is not working correctly and I don't know how to debug.
 
Can someone please tell me what could be going wrong or how do I debug this?
Thank you for your help!
Best Answer chosen by Rachana Chaudhari
Nisar AhmedNisar Ahmed
global class EmailMessageScheduler implements Schedulable {
    global void execute(SchedulableContext SC) {
        Map<String,Datetime> toAddressMap = new Map<String,Datetime>();
        for(EmailMessage eMessage : [SELECT Id, ToAddress,CreatedDate FROM EmailMessage WHERE CreatedDate = TODAY ORDER BY CreatedDate ASC]){
            toAddressMap.put(eMessage.ToAddress, eMessage.CreatedDate);
        }
        List<Contact> conListToUpdate = new List<Contact>();
        for(Contact c : [SELECT Id,Email FROM Contact WHERE Email IN :toAddressMap.keySet()]){
            // c.Last_Contact_Date__c =  toAddressMap.get(c.Email); // If Last Contact Date is of datetime type
            // c.Last_Contact_Date__c =  (Date)toAddressMap.get(c.Email); // If Last Contact Date is of Date type
            conListToUpdate.add(c);
        }
        if(conListToUpdate.size() > 0){
            UPDATE conListToUpdate;
        }
    }
}

Once you save this class, Please uncomment the appropriate line for your last contact date field. Schedule the Apex from Setup => Apex Classes => Schedule Apex => Select this class and time, you can schedule this around midnight.
Kyle YorkKyle York 
I made a component that I would like to show on all records. The component simply shows a timestamp. But when I got to Setup>Accounts>Page Layouts>Components I don't see my component as an option. 

My code is below:
<apex:component controller = "timeStamp_controller">

    <div align="right">
            {!NOW()}   
    </div>

</apex:component>

 
Best Answer chosen by Kyle York
Amnon KruviAmnon Kruvi
To show a Visualforce page (page, not component) in a record page, you need to create a page with a standard controller for each individual object that you want to place it in. That means 1 VF page per object.

Here is a li k on how to use standard controllers. You don't need anything complicated, just add that attribute: (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_std_associate.htm)
Gislane PaganoGislane Pagano 
 Why does Asset not occupy storage and Entitlement does?
Best Answer chosen by Gislane Pagano
Nisar AhmedNisar Ahmed

https://help.salesforce.com/articleView?id=admin_monitorresources.htm&type=5 (https://help.salesforce.com/articleView?id=admin_monitorresources.htm&type=5)

Please check the above link, at the end it says that 

 

Active or archived products, price books, price book entries, and assets don’t count against storage.
 

Connor SmallConnor Small 
Is it possible to give users edit access to standard objects without enabling the "Modify all data" user permission??
Best Answer chosen by Connor Small
Amnon KruviAmnon Kruvi
Absolutely. There are three things you need to do to grant someone access:
In the user profile, make sure the user has read (and edit if you want) access to the object. Also, ensure they have access to the relevant fields.
Now you also need to ensure the users have access to the records. By default, users only have access to records they own, or are owned by users beneath them in the role hierarchy. You can go to Setup -> Sharing Settings to change that, either by making certain objects public read (or public read write), or by creating sharing rules that expose records to users based on conditions.
Michele FosterMichele Foster 
I created the email; however, when I try to test it using these instructions:
Send an Email Test
Finally, test your email template.
Click the Contacts tab.
Select All Contacts from the menu, then select Sean Forbes.
Click Email in the Activity tab. (You may have to click More to find it.)
Click the Insert, create, or update template icon  .

Email does not exist in the Activity tab. I switched to Classic view and clicked on "More" but it still does not exist.
User-added image

I believe I should be in the Sales app when performing this, but I'm not even positive about that. 

Has anyone found a resolution to this?
Best Answer chosen by Michele Foster
Neeraj SethiNeeraj Sethi
View the page layout for the object you want to update.
Classic:
User-added image
User-added image

Lightning:
Make sure Send an Email are added to the Salesforce Mobile and Lightning Experience Actions section of the page layout.

Hope this will help

Thanks
Neeraj Sethi
Shawn LowShawn Low 
The field is a "counter" field, so I am using an "IF" statement in the formula.
The caluclation needs to be the "CLOSEDATE" minus (-) the "CREATEDATE", but this needs to be a number.
My initial formulas was:
IF ( CLOSEDATE - CREATEDATE <= 3, 1, 0)
The issue is, the date fields are just that, a date field, not a number field.
Thanks
Shawn
Best Answer chosen by Shawn Low
Nisar AhmedNisar Ahmed
Hi Shawn,

Please try the below formula field in your formula field, please ensure that the return type of your formula is Number.
 
CloseDate - DATEVALUE(CreatedDate)
Best Regards
Nisar Ahmed
 
Kim LebiczKim Lebicz 
I received an email a while back announcing a instance migration for my org but misplaced the email. Is there somewhere I can find the schedule for migrations from my current instance?
Best Answer chosen by Kim Lebicz
Matt HittMatt Hitt
@Kim You might be able to find this on the Salesforce Trust site.  https://trust.salesforce.com
Stacey MillerStacey Miller 
Hello all!!

I am a new Administrator and am coming into a fully developed Org. I have had zero experience with IF formulas as our Dev team was responsible for that at my previous company. I am needing to add a variable to the below formula and keep getting Syntax errors with everything I try. 

I am needing to add "Cancer" to the second part of the IF statement that "contains (Selected_Opportunity_Product_c, "Critical") " (bolded below). I need it to search for both values and then add it to the "Critical Illness" bucket. 

Any help is very much appreciated!! Thank you in advance :-)



if(RecordType.Name ="Accident Products","Accident",""+



if(RecordType.Name ="Benefit Products"&&(contains( Selected_Opportunity_Product__c ,"Critical")),"Critical Illness",""+

if(RecordType.Name ="Benefit Products"&&(not(contains( Selected_Opportunity_Product__c ,"Critical"))),"Health","")))
Best Answer chosen by Stacey Miller
Steve MolisSteve Molis
So basically something like this?
IF(RecordType.Name = "Accident Products",
"Accident",
IF(RecordType.Name = "Benefit Products"
	IF(
	OR(
	CONTAINS( Selected_Opportunity_Product__c ,"Critical"),
	CONTAINS( Selected_Opportunity_Product__c ,"Cancer")
	),
	"Critical Illness",
	"Health"),
NULL))
or 
CASE(RecordType.Name,
"Accident Products",
"Accident",
"Benefit Products",
IF(
OR(
CONTAINS( Selected_Opportunity_Product__c ,"Critical"),
CONTAINS( Selected_Opportunity_Product__c ,"Cancer")
),
"Critical Illness",
"Health"),
NULL)

 
Kyle YorkKyle York 
For the life of me I can't get my "text" to align to the right. Here is my code:
 
<apex:page controller = "timeStamp_controller" >
	<table style="text-align:right;">
    	{!NOW()}   
    </table> 
</apex:page>

{!NOW()} is the "text" I need to alighn to the right
Best Answer chosen by Kyle York
Prudvi ParepalliPrudvi Parepalli
Kyle,
Try this

<apex:page controller = "timeStamp_controller" >
    <div align="right">
            {!NOW()}   
    </div>
</apex:page>