• Rakshith Ramachandra
  • NEWBIE
  • 165 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 55
    Replies
Process Builder executes one Action and not the other one. It's doesn't throw any error. Also 95% of the time both actions are executed but the rest of the time onely one action is executed and the other one does not.

User-added imageContact Update works and Account Update doesn't.
I have a picklist field A on contact record. picklist field B on contact opportunity record. They have the same name on both objects. 

When I'm on contact record and I click on new opportunity, I want the info from field A to get copied to field B when I click on "New opportunity" on Contact page.

What's the simplest way of doing this? Any ideas?

Thanks,
Rakshith
I see one of our contacts from an account has been deleted. I tried restoring it from Recycle bin. But I don't see the contact in there. Is there any other way of undeleting the contact? I've the all the necessary information about the contact - First name, Last name, Contact ID, Account name.

Please provide step by step instuctions to do the same. Thanks in advance!
I trying to customize the SalesForce home page to show direct links to some of the important reports. The idea is to put a simple image on the homepage and when clicked on it, it redirects to a SF report (Let's assume it's ID is 00O370000020O7W)

Please let me know step by step how to achieve this?
I have a csv file of Email Id, First name, Last name, Phone, Account Name of close to 3000 contacts (No ID's available). I'm Positive these contacts exist in SalesForce. But the challenge is it's in a CSV and I need to add these contacts to a campaign so that they can be sent a specific email.

Note: I can't run a report with a filter saying email = "A or B or C or D or ..." as we have 3000 contacts and only limited amount of characters are allowed in the that filer field.

Thanks in advance!
Can I create a variable in SalesForce environment and save it. So that it can be accessed in formulas? 
I'm trying to get percentage quota for each user. It's basically Number of calls made * 100 / Expected quota. Expected quota remains the same for all users. Currently I've created a new field called quota and duplicated the same value across the table. Is there a way I can create a global constant called quota and assign a value to it to use it in a formula?
My production system is at 75% and I'm trying to deploy a trigger. It's 100% covered. The deployment fails saying code coverage is 74%.

I'm wondering how the code coverage decreased when I'm testing all the lines I'm trying to push from Sandbox. 

Any pointers?
There are times where I create new custum fields directly in Production. But the Sandbox won't have those fields. Now I want to sync Sandbox with production as I'm testing few things on sandbox. Is there a quick way to do it?

Current situation -
Production = A + B + C
Sandbox = A + B + D

After sync -
Production = A + B + C
Sandbox = A + B + C + D

Please help

 
Below trigger updates the Employee count under contact record whenever the employee count under Task it's task is updated.
trigger Update_employee_count_in_activity on Task (after insert, after update) {
	List<Contact> contsToUpdate = new List<Contact>();
	Schema.DescribeSObjectResult r = Contact.sObjectType.getDescribe();
	String keyPrefix = r.getKeyPrefix();
	for(Task t:trigger.new){
		String myIdPrefix = String.valueOf( t.WhoId).substring(0,3);
		if(myIdPrefix == keyPrefix){
			Contact cont = new Contact();
			cont.Id = t.WhoId;
			cont.Employees__c = t.FT_Emp__c;
			contsToUpdate.add(cont);
		}
	}
	if (contsToUpdate.size() > 0)
    {
        update contsToUpdate;
    }
}

Can anyone help me with the test class for this trigger? Thanks
Source Object - Activity
Source Field - FT_Emp__c
Destination Object - Contact
Destination Field - Employees__c
trigger Update_employee_count_in_contact on Task (after insert, after update) {
    // set up lists you will need
    List<Contact> consToUpdate = new List<Contact>();    
    
    Map<Id, Task> taskMap = new Map<Id, Task>();

    // go through the list of tasks that were inserted
    for (Task t: Trigger.New)
    {
            taskMap.put(t.WhoId, t);
    }
    
    if (taskMap.size() > 0)
    {
        // get all of the contacts related to the tasks
        // Code logic to update Employees__c field of Contact field
        .
        .
        .
        
        if (consToUpdate.size() > 0)
        {
            update consToUpdate;
        }
    }
}

I want Employees__c to be equal to FT_Emp__c when FT_Emp__c is updated. 

Can anybody help me complete the above the code snippet?
After enabling Chatter Answers in SalesForce, we are facing Code coverage issue and we are not able to deploy anything. I'm trying to fix the errors and I think I'm  getting close. I found this link which helped. There is a line which mentions about adding the right profileId to make it work. Which profileId am I supposed to add there?

https://success.salesforce.com/issues_view?id=a1p300000008XHfAAM

I'm talking about this line below.
u.profileId = '';

Thanks,
Rakshith
 
Source Object - Activity
Source Field - FT_Emp__c
Destination Object - Account
Destination Field - Total_FTE__c

I want Total_FTE__c to be equal to FT_Emp__c when FT_Emp__c is updated. Here's the trigger I've come up with so far.
trigger Update_employee_count_in_activity on Task (after insert, after update) {
    // set up lists you will need
    List<Account> accsToUpdate = new List<Account>();    
    
    Map<Id, Task> taskMap = new Map<Id, Task>();

    // go through the list of tasks that were inserted
    for (Task t: Trigger.New)
    {
            taskMap.put(t.WhoId, Activity.FT_Emp__c);
    }
    
    if (taskMap.size() > 0)
    {
        // get all of the contacts related to the tasks
       accsToUpdate = [SELECT Id, Total_FTE__c
                        FROM Account 
                        WHERE Id IN: taskMap.keySet()];
        // go through the list for each contact
        for (Account c: accsToUpdate)
        {
            // total_fte_c should be equal to FT_Emp__c (Activity field)
            c.Total_FTE__c = taskMap.get(c.Id);
        }
        
        if (accsToUpdate.size() > 0)
        {
            update accsToUpdate;
        }
    }
}

The trigger doesn't seem to work and also I'm getting an error - "Save error: Entity is not api accessible". Any guidance would be appreciated. 

Thanks
I'm trying to create a validation rule for Phone field in Salesforce. It accepts any number of digits. I want to limit it between 9-13. So I've to write up a validaition that does that. Remember I'm trying to count the number of  'DIGITS' only.
So I can't use OR(LEN(Phone) < 9, LEN(Phone) > 13). LEN counts the spaces, brackets etc.

For eg: (832) 999-9999 has 10 digits but 14 characters. LEN returns 14 not 10
I have a phone field and I want add the following rules to that field.
1. If the length of the field is less than 9. It should throw an error.
2. It should not accept numbers like 111-111-1111
3. It should not contain any characters (A-Z) (a-z)
4. It should not contain special characters except "("    ")"    "-"  and "+"

Can anyone help help me with this. Thanks?
I need to write a apex batch class and schedulable class to run every day which sends a email notification using an email template. The condition is that whenever LastModifiedDate field from Opportunity field is less a year from today the email needs to be sent to the opportunity owner

Here's what I've come up with so far.

Batch class -
global class BatchInactiveOpps implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        return Database.getQueryLocator([SELECT CloseDate,Description,Id,LastModifiedDate FROM Opportunity WHERE LastModifiedDate < LAST_N_DAYS:365]);
    }

    global void execute(Database.BatchableContext BC, List<Opportunity> scope)
    {
    	List<Messaging.SingleEmailMessage> mailsToSend = new List<Messaging.SingleEmailMessage>();
        for(Opportunity opp:scope){
			//TBD
			EmailTemplate template = [SELECT id FROM EmailTemplate WHERE DeveloperName = 'Opportunity_about_to_expire_template'];
			Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setTemplateId(template.Id);
            mail.saveAsActivity = false;
            mailsToSend.add(mail);
            System.debug(opp.Name);
        }
        //Send Email
		if(mailsToSend.size() > 0){
    		Messaging.sendEmail(mailsToSend);       
		}
    }
    
    global void finish(Database.BatchableContext BC)
    {
    }
}

Schedulable class
global class SchedulableInactiveOpps implements Schedulable
{
    global void execute(SchedulableContext sc)
    { 
		Id InactiveOpps=Database.executeBatch(new BatchInactiveOpps());
    }
}

Test class
@isTest(SeeAllData=true)
public class TestemailonDuedate {
	public static testMethod void unitTest(){
		Test.startTest();
		EmailTemplate template = [SELECT id FROM EmailTemplate WHERE DeveloperName = 'Opportunity_about_to_expire_template'];
		Task tsk=new Task();
			tsk.ActivityDate=System.Today();
			tsk.Subject='Test';
			tsk.Status='In Progress';
			tsk.Priority='Normal';
			Insert tsk;
			System.assertEquals(tsk.Subject,'Test');

			emailonDuedate emailSch = new emailonDuedate();
			String sch = '0 0 23 * * ?'; 
			System.schedule('Test Territory Check', sch, emailSch); 
		Test.stopTest(); 
	}

}
Opportunity_about_to_expire_template is the email template i want to use while sending the email. 

Please let me know what changes needs to be done to the batch class and test class to make it work. 
Something like TEXT(Implementation_Stage__c) = ANY("X", "Y", "Z").

Implementation_Stage__c is a picklist. If it's value is X or Y or Z. Do something.
GOAL: We are trying to clean up the page layouts and we want to delete all the page layouts which are not being used currently by any profiles. 

We have close to 60 profiles and I want to know which Page layouts (Lead, Opportunity, Contact) are being used by each profiles. Then I can go ahead and delete unused ones. 

I have to open each profile and check which layout are being used. Is there a way to get it from reports?

OR Is there a better way to achieve the goal?
I'm trying to check if an opportunity has been inactive for a year. If yes, I'll send an email notification.

I'm using process builder to do this. But I'm not sure how to check if Last modified date was before 12 months from today. I'm able to come up with 
this Opportunity.LastModifiedDate < TODAY - DAYS(365)

Let me know what modifications needs to be done
User-added image
I'm trying to check if an opportunity has been inactive for a year. If yes, I'll send an email notification.

I'm using process builder to do this. But I'm not sure how to check if Last modified date was before 12 months from today. I'm able to come up with
this Opportunity.LastModifiedDate < TODAY - DAYS(365)

Let me know what modifications needs to be done
User-added image
I have a picklist field A on contact record. picklist field B on contact opportunity record. They have the same name on both objects. 

When I'm on contact record and I click on new opportunity, I want the info from field A to get copied to field B when I click on "New opportunity" on Contact page.

What's the simplest way of doing this? Any ideas?

Thanks,
Rakshith
GOAL: We are trying to clean up the page layouts and we want to delete all the page layouts which are not being used currently by any profiles. 

We have close to 60 profiles and I want to know which Page layouts (Lead, Opportunity, Contact) are being used by each profiles. Then I can go ahead and delete unused ones. 

I have to open each profile and check which layout are being used. Is there a way to get it from reports?

OR Is there a better way to achieve the goal?
Process Builder executes one Action and not the other one. It's doesn't throw any error. Also 95% of the time both actions are executed but the rest of the time onely one action is executed and the other one does not.

User-added imageContact Update works and Account Update doesn't.
I have a picklist field A on contact record. picklist field B on contact opportunity record. They have the same name on both objects. 

When I'm on contact record and I click on new opportunity, I want the info from field A to get copied to field B when I click on "New opportunity" on Contact page.

What's the simplest way of doing this? Any ideas?

Thanks,
Rakshith
I trying to customize the SalesForce home page to show direct links to some of the important reports. The idea is to put a simple image on the homepage and when clicked on it, it redirects to a SF report (Let's assume it's ID is 00O370000020O7W)

Please let me know step by step how to achieve this?
I have a csv file of Email Id, First name, Last name, Phone, Account Name of close to 3000 contacts (No ID's available). I'm Positive these contacts exist in SalesForce. But the challenge is it's in a CSV and I need to add these contacts to a campaign so that they can be sent a specific email.

Note: I can't run a report with a filter saying email = "A or B or C or D or ..." as we have 3000 contacts and only limited amount of characters are allowed in the that filer field.

Thanks in advance!
Can I create a variable in SalesForce environment and save it. So that it can be accessed in formulas? 
I'm trying to get percentage quota for each user. It's basically Number of calls made * 100 / Expected quota. Expected quota remains the same for all users. Currently I've created a new field called quota and duplicated the same value across the table. Is there a way I can create a global constant called quota and assign a value to it to use it in a formula?
My production system is at 75% and I'm trying to deploy a trigger. It's 100% covered. The deployment fails saying code coverage is 74%.

I'm wondering how the code coverage decreased when I'm testing all the lines I'm trying to push from Sandbox. 

Any pointers?
Source Object - Activity
Source Field - FT_Emp__c
Destination Object - Contact
Destination Field - Employees__c
trigger Update_employee_count_in_contact on Task (after insert, after update) {
    // set up lists you will need
    List<Contact> consToUpdate = new List<Contact>();    
    
    Map<Id, Task> taskMap = new Map<Id, Task>();

    // go through the list of tasks that were inserted
    for (Task t: Trigger.New)
    {
            taskMap.put(t.WhoId, t);
    }
    
    if (taskMap.size() > 0)
    {
        // get all of the contacts related to the tasks
        // Code logic to update Employees__c field of Contact field
        .
        .
        .
        
        if (consToUpdate.size() > 0)
        {
            update consToUpdate;
        }
    }
}

I want Employees__c to be equal to FT_Emp__c when FT_Emp__c is updated. 

Can anybody help me complete the above the code snippet?