• dev2014
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 12
    Replies
Hi ,

What is the effect of changing the relationship between objects on on the data or code developemnt in your org?for example changing a one to many to a many to many relationship etc.   An input, link to a video on that subject (preferred ) or an article would be appreciated..

Thanks,

Ben
Hi all,  Can you send a specifc link that make  it easy to understand the Apex syntax and logic? Perhps like a table that shows syntax one side and the meaning (logic) on the other side.

Thanks.
Is there a way to keep the user in the visual forcce sectoion record when he edits a field in the contact record  even if he is in the account  page.  so the use case iswhen a user update/edit the cotnnact record in the contact related list to the account.  The related list contact section and contact record  is a visual force page. The  account page  is  not a visual force page.
The flow is:

1.User go to the contact  visual force  related section inthe account page (not visual force)
2. go to a specific record in the  contact related list click the viual force  based save button in the the contact record
3. I want the user stay in the visual force contact recordthat he is in  after he clicks the save button on the record level instead of throwing him back to the yop ofthe accoutn page.

I would appreciate  if you can provide input into a visual force code that can impement that use scenario.

Thanks,
Hi, What is the best way to add an "Attach to your  case " display button from my technical solution  object  record to the solution related section of the case detailed page record .  
Thanks,
 
Hi, my client  has a scenario  where his  queue managers get notifications from their queues regardng new cases via their queue email distribution list.  
For a few customers when they open their case the queue  managers gets a notification directly from the customer name in 'from" of the email opposed as from the Salesforce email distribution list name..

Is there a quick way to locate which queues those customers cases were directed to initially so I can check if that is a queue notification configuration issues? (instead of going through each queue and look at the configuration differences). Thanks. 
  • September 22, 2015
  • Like
  • 0
 Hi,
We want to solve a customer case problem with target time of 6 hours.

So the process rules logic is the following:
1. Agent log an incoming case and select case technical type (picklist value)
2. Agent select organization type (picklist value)
3. default Target resolution assigned for the case is 6  hours
4. Agent taking the call can't solve the case
5. Based on the rules above case will be automatically escalated to the 2 experts users identified in in the system
6. sending  an automatic task or an email alert message " please solve  this case by X  target date and time.." (calculating the default target resolution time for such type of case and subtracting the  date case was created in business hours)
 
As I understand that age over works for when t escalate it but not automatically calculates when case due date. What is the most efficient way to implement it? escalation rules, process builder, flow or Apex code? 
 
Thanks,
Did anybody develop an Apex trigger or workflow on leads and Accounts or on Opportunity and Accounts so only when opportunity status was "closed/won" only then an Account will automatically be open in the Account Object. That way you can prevent data errors and create  data quality in which only customers are under the account object. Your feedback would be appreciated..

Thanks
Hi, I'm trying to Add fields from my contact object to the search result view of my customized Credit Cards object.. such as "first name, last name, mailing adress,city ,country that belongs to the Contact object..How do i do that without coding and formulas?

i added a lookup field on Credit Cards object but couldnt find the city, country, maling adresss fields on the Credit Card objects layout options so I can add them to the Credit Card layout...any ideas on how to implment that? a link to a video demo or text on how that subject would be great as well..

Thanks,
 
Hi,
 I used the formula below to get the first 4 digit of the credit card number field  but formula field remained  blank and was not updated once i entered the credit card number..
Formula:IF(NOT(ISBLANK(credit_card_number__c)), '', LEFT(credit_card_number__c, 4))

What is the correct syntax to implement this so it works  ?
Thanks,

Ben 
 

Hi All,

While  working on Salesforce point & click functionalities , we are trying to complete the final  part of the logic  of our Apex trigger for a client .

The final part of the business logic we are trying to implement now is to automatically take leads with "Annual Revenue" amount of  above 500k  and a pick list value of "finance"  for the "vertical"  field  and assign it to the "Financial  expertise"  team Queue :

if (l.AnnualRevenue >= 500000 & l.Vertical__c == 'Finance') { 

then

Assign lead to the "Financial Expertise" Queue

I created a pick list based "vertical "field on the Lead  object and a created  Queue named "Financial Expertise" based on the Lead  object for this purpose.

I would appreciate your code input on this use case or code reference to similar use case where you assign the lead to a specific Queue. This is my first Salesforce project so I appreciate your input and help on this.

I guess I would have  to assign a lead owner value to the "Finance Expertise" Queue ID. what would be the queue assignment code input for this if statement:

if (l.AnnualRevenue >= 500000 & l.Vertical__c == 'Finance') { 


Assign lead owner to the the "Financial Expertise" Queue ID  ?

Thanks. This is my first Salesforce project so I appreciate your  input.

 

Hi,

We are trying to complete the final  part of the logic  of our Apex trigger for a client . We were able to successfully implement the first part of the  logic where  the Apex trigger  automatically  takes  a lead that  is above 500k and has the  picklist field value of  "Finance"  and  automotically creates a task to the lead  creator and owner.

The final part of the business logic we are trying to implement now is to assign the above 500k and finance vertical to the "Financial  expertise"  team Queue and create a task for this Queue team .

if (l.AnnualRevenue >= 500000 & l.Vertical__c == 'Finance') { 

then

Assign lead follow up task to the the "Financial Expertise" Queue

Below is the code we have got so far for the first conditional part of the logic. (We had to switch the object from the Opportunity objet to the Lead Object since you can't create a Queue on the Opportunity object)

 I guess one way to do it is to assign a lead owner value to the "Finance Expertise" Queue ID.

I created a pick list based "vertical "field on the Lead  object and a created  Queue named "Financial Expertise" based on the Lead and Activity objects for this purpose. (See screenshots below)

I would appreciate your code input on this use case or code reference to similar use case where you assign the lead and task to a specific Queue. This is my first Salesforce project so I appreciate your input and help on this.

trigger LeadCreation on Lead (after insert) {
    
    // If tasks are to be created then save them in a separate set and run dml operations outside loop statements   
    List<Task> tList = new  List<Task>();
    Map<Id, Lead> leadMap = new Map<Id, Lead>();
    
    //loop through all new Leads  saved
    for(Lead l: Trigger.new)
    {
        // if the Lead amount is greater than 500000 AND Lead  Vertical = Finance 
        if (l.AnnualRevenue >= 500000 & l.Vertical__c == 'Finance') {

            //assign lead to financial expertise team and create a task for the finacial expertise queue ...
            Task T        = new Task();
            T.Type        = 'Email';
            T.Description = 'A lead was created with amount  of  above 500,000 in your speciality field';
            T.OwnerId     = l.OwnerId;
            T.WhatId      = l.Id; //record id
        
            // DO NOT RUN DML OPERATIONS INSIDE FOR LOOPS            
        tList.add(T);
        leadMap.put(l.Id,l);
    }
        else {
            // if the annual amount is less than 500000 and not financial vertical do nothing ....
        }
    }
    
    if(tList!=null && !tList.isEmpty()){
    LeadTriggerHelper.createTasks(tList, leadMap);
    }
}
public class LeadTriggerHelper {

	
	public static void createTasks(List<Task> tList, Map<Id, Lead> leadMap){
		Set<String> tIds = new Set<String>();
		try{
		
		    Database.SaveResult[] srTask  = Database.insert(tList, false);

			for (Database.SaveResult sr : srTask) {
				if (sr.isSuccess()) {
					// Operation was successful, so get the ID of the record that was processed and fire an email
					System.debug('Successfully created the task. ID: ' + sr.getId());					
					tIds.add(sr.getId());
				}
				else {
					// Operation failed, so get all errors                
					for(Database.Error err : sr.getErrors()) {
						System.debug('The following error has occurred.');                    
						System.debug(err.getStatusCode() + ': ' + err.getMessage());
						System.debug('Task fields that affected this error: ' + err.getFields());
					}
				}
			}
			
			if(tIds!=null && !tIds.isEmpty()){
				for(Task tObj : [SELECT Id, What.Name, WhatId FROM Task WHERE Id IN :tIds]){
					Lead leadObj = leadMap.get(tObj.WhatId);
					SendEmailNotification(leadObj.OwnerId, 'Finance Lead TASK WAS CREATED FOR YOU ON SALESFORCE  !!!', 'GO GETHEM', tObj.WhatId, tObj.What.Name);
				}
			}
		}
		catch(Exception err){
			system.debug('\n Error while creating tasks. \n'
                                  + err.getMessage() + ' \n'
                                  + err.getStackTraceString());			
		}
	}
	
	public static void SendEmailNotification(Id SendTo, string Subject, string BodyText, String LinkURL, String LinkLabel){
		try
		{
			Messaging.reserveSingleEmailCapacity(1);
			Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
			mail.setTargetObjectId(SendTo);
			mail.saveAsActivity = false;
			mail.setSenderDisplayName('Salesforce custom big deal alert');
			mail.setSubject(Subject);

			if (LinkURL != null) {
				mail.setHtmlBody(BodyText + '<br />' + 'Click for details : ' + '<a href=' + LinkURL + '>' + LinkLabel + '</a>');
			}
			else {
				mail.setHtmlBody(BodyText);
			}
			Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
		}
		catch (Exception err) { 
			system.debug('\n Error while sending email. \n'
                                  + err.getMessage() + ' \n'
                                  + err.getStackTraceString());			
		}

	} 


}
User-added image

User-added image
Hi, I'm trying accomplish the following business logic:

1. IF  opportunity record is a financial vertical type And IF the opportunity is above $500K
2. Create a task to send an email to opportunity owner.

Here's what I have so far . I would appreciate your input of whats missing or  filling the blanks to make it work .

trigger on OpportunityCreation on opportunity (before insert) {

 

    //loop through all new opportunities  saved

    for(Opportunity Op: Trigger.new)

    {

         // if the Opportunity amount is greater than 500000

         if (Op. Amount_c >= 500000)

//and  if Opportunity  Vertical  (customized  pick list field)  value = Financial

         If (Op. Vertical_c) = 'Financial'

                // create a user task that ...

               

            Task T = new Task();

            T.Type = 'Email';

            T.Description = Opportunity was created with amount  of  above 500,000 in your speciality field'; //string

            T.OwnerId = Op.OwnerId;

            //T.WhatId = ''; //record id

   

           insert T;

}
         else
         {
             // if the anual amount is less than 500000 and not financial vertical do nothing ....
         }
        
    }
}
Hi my client wants to implement an Apex  trigger selecting email of specific accounts on a specific date.  I would appreciate your direction to similar code reference. Below is the first steps of the business logic.


1.       Trigger starts When today date= end of quarter date  update accounts based on end of quarter date field (date type  field with  case based  date formula on the field defaults value)

2.       Automatically select  Account list view of "My_large_accounts" list  view 

3.       Automatically Select email contacts for those "My_large_account" accounts list

An input  link to similar apex trigger code case   I'm new to Apex development so  ideas on how to get things going on this case would be appreciated.
 
Thanks,

Hi,

My client wants to use the Apex Trigger method.
The business logic we are trying to implement using apex trigger is the following. From the links below it seems like it's possible  to create a trigger that update a date field of the end of Quarter field date I created.

 

1.       Trigger starts when today date value= end of quarter date value  update accounts based on end of quarter date case formula (see  date field formula cases  and account record on sceenshots below  i.e. date(year(today()), 03,31),
date(year(today()), 06,30) etc,)

2.       Automatically select  Account list view of "My_large_accounts" list  view  (see screenshot below)

3.       Automatically select email contacts for those "My_large_account" accounts

4.       Automatically select  the assigned most updated email template to those "large accounts"  at the time of the trigger (email template could be updated manually before each end of quarter while still assigned to the same accounts)

5.       Send email to  those specific email contacts of "My_large_accounts"  every time the end of quarter triggers starts (When End of quarter field =todays field see account example screenshot)

I'm new to Apex trigger and trying to create the most efficient Apex Trigger to implement this. I would appreciate if you could refer  to similar Apex triigger code references or similar examples.

Thanks,



 

 

 

Based on the link below an date based trigger can be implemented.

 

Trigger to update the Date field one day less than to next year?

trigger dateUpdate on Pincode__c (before insert, before update)
{
    for(Pincode__c p : trigger.New)
    {
        p.X1st_Anniversary__c = p.Evaluation_Date__c.addDays(364);
        p.X6th_Anniversary__c = p.Evaluation_Date__c.addDays(2184);
    }

 

http://sfdc2u.blogspot.in/2013/04/trigger-to-update-date-field-one-day.html

 

http://salesforce.stackexchange.com/questions/20487/update-field-using-trigger

 

 

Hi,

 I am trying to create an Apex Trigger for my client. That trigger send automatic emails in the end of every quarter to existing and new customer accounts of $500,00 and above. I am trying to learn more about  customizing Apex Trigger anyway.

 Can you possibly  direct me to some references, links, demos  of similar Apex Trigger casesso I can learn to create the Apex trigger  script for such use case?

Thanks,

 

 

Thanks,

 

Did anybody develop an Apex trigger or workflow on leads and Accounts or on Opportunity and Accounts so only when opportunity status was "closed/won" only then an Account will automatically be open in the Account Object. That way you can prevent data errors and create  data quality in which only customers are under the account object. Your feedback would be appreciated..

Thanks
Hi, I'm trying accomplish the following business logic:

1. IF  opportunity record is a financial vertical type And IF the opportunity is above $500K
2. Create a task to send an email to opportunity owner.

Here's what I have so far . I would appreciate your input of whats missing or  filling the blanks to make it work .

trigger on OpportunityCreation on opportunity (before insert) {

 

    //loop through all new opportunities  saved

    for(Opportunity Op: Trigger.new)

    {

         // if the Opportunity amount is greater than 500000

         if (Op. Amount_c >= 500000)

//and  if Opportunity  Vertical  (customized  pick list field)  value = Financial

         If (Op. Vertical_c) = 'Financial'

                // create a user task that ...

               

            Task T = new Task();

            T.Type = 'Email';

            T.Description = Opportunity was created with amount  of  above 500,000 in your speciality field'; //string

            T.OwnerId = Op.OwnerId;

            //T.WhatId = ''; //record id

   

           insert T;

}
         else
         {
             // if the anual amount is less than 500000 and not financial vertical do nothing ....
         }
        
    }
}

Hi,

My client wants to use the Apex Trigger method.
The business logic we are trying to implement using apex trigger is the following. From the links below it seems like it's possible  to create a trigger that update a date field of the end of Quarter field date I created.

 

1.       Trigger starts when today date value= end of quarter date value  update accounts based on end of quarter date case formula (see  date field formula cases  and account record on sceenshots below  i.e. date(year(today()), 03,31),
date(year(today()), 06,30) etc,)

2.       Automatically select  Account list view of "My_large_accounts" list  view  (see screenshot below)

3.       Automatically select email contacts for those "My_large_account" accounts

4.       Automatically select  the assigned most updated email template to those "large accounts"  at the time of the trigger (email template could be updated manually before each end of quarter while still assigned to the same accounts)

5.       Send email to  those specific email contacts of "My_large_accounts"  every time the end of quarter triggers starts (When End of quarter field =todays field see account example screenshot)

I'm new to Apex trigger and trying to create the most efficient Apex Trigger to implement this. I would appreciate if you could refer  to similar Apex triigger code references or similar examples.

Thanks,



 

 

 

Based on the link below an date based trigger can be implemented.

 

Trigger to update the Date field one day less than to next year?

trigger dateUpdate on Pincode__c (before insert, before update)
{
    for(Pincode__c p : trigger.New)
    {
        p.X1st_Anniversary__c = p.Evaluation_Date__c.addDays(364);
        p.X6th_Anniversary__c = p.Evaluation_Date__c.addDays(2184);
    }

 

http://sfdc2u.blogspot.in/2013/04/trigger-to-update-date-field-one-day.html

 

http://salesforce.stackexchange.com/questions/20487/update-field-using-trigger