• Giancarlo Amati
  • NEWBIE
  • 50 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 43
    Replies
Dear All, 
can someone help me out to understand what is this about? I am sure I haven't deployed any flow in production, is it possible that it's using TLS 1.1 version which has been deprecated?

Thank you .G


Apex script unhandled exception by user/organization: 0051400000B2jVZ/00D300000000ab7

Failed to process batch for class 'DB4SF.PageViewSchedulable' for job id '7071O00006jAlEm'

caused by: System.CalloutException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable"

Class.DB4SF.DBAPI.execute: line 63, column 1
Class.DB4SF.PageViewSchedulable.execute: line 85, column 1
Hi Team,

I'm reviewing an Apex Batch job that failed overnight. I would like to update the email address that it sends in case of failure. I cannot figure out where this is built, but I've found this code in the Apex Class. There is a function called 'Label.BatchJobMonitors.split(';')' but I cannot find the definition. The 'toAddresses' is build based on that.
Any help?
Thank you
String status = (String.isEmpty(job.Status)) ? '' : job.Status;
          status = status.toLowerCase();
          ApexClass ac = [SELECT Id, Name FROM ApexClass WHERE Id =: job.ApexClassID];
      String className = ac.Name;
          Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
          String[] toAddresses = Label.BatchJobMonitors.split(';');
          mail.setToAddresses(toAddresses);
          mail.setSubject(subject);

 

Dear Team,
is there a way to create a button similar to the "Manage External user" on the contact object that will assign that contact to a default Campaign automatically ?

Thank you.

GC
User-added image

Dear All,
I have the following Javascript code for a button "Submit for Approval". When I try to send an alert passing the value of {!SBQQ__Quote__c.Deal_Type__c} that is a TEXT value, I receive the following message below.

Any help?
Thank you

User-added image
 
this.disabled = true;
this.className = 'btnDisabled';

if (  ({!SBQQ__Quote__c.Show_Lines_Summary__c} == '')||({!SBQQ__Quote__c.SBQQ__Primary__c}== '' )) {
 
 
window.alert('deal type: ' + {!SBQQ__Quote__c.Deal_Type__c} ); 

} else window.alert('dummy');

 

Dear Team,
when creating a new Opportunity record for a specific account, I would need to access the value of a custom field from the most recent closed-won opportunity of a certain deal type. 

What would be the best approach here? Building an Opportunity Trigger and use SOQL to access the most recent opportunity? 
 

Thank you. 

GC

Dear Team
this is a question about CPQ and contract templates. Specifically, our contract template has the following item in the "Sections" section. 

https://c.na79.visual.force.com/apex/ContractHeader1

which looks like a visual force page. But I cannot find it in our production environment. 

When I click on it, I get the following error:
List has no rows for assignment to SObject 
An unexpected error has occurred. Your development organization has been notified.

Where should I be looking at? Is there an Apex Class that will generate a visual force page called that way? 

Thank you.
User-added image

Dear All,
we have a system (bespoke) called Origin, which syncs with Salesforce every 5 minutes. 
What it does is: creating Accounts and or updating account records. 

I have one question: this origin is hosted somewhere in our company. Is there a way in Salesforce to understand what API calls are, to run some kind of report. Anything that can let us know what that Origin system is touching? We don't have a touch with the original developers. 

Thank you.

GC

Dear All, 
in the contract object I have two fields. One is a text formula, which fetches the name from the related opportunity. The second one, is a contract text field. 
The problem I have is to detect when the value of the first field changes so that I can update the second one. I thought to a contract trigger:
where I want Customer_Contract_ID__c to get updated every time the value of Contract_Name_ref__c changes. Both are fields from the same contract object. 
For whatever reason I don't see any change.

Thank you for your help.
trigger CustomerContractIDHasChanged on Contract (before update) {

/* Fetch the records that have been udpated */
Map<Id, Contract> m_contract = new Map<Id, Contract> ([SELECT Id FROM Contract WHERE Id IN :Trigger.New]);

If (trigger.isUpdate) {

For (Contract c: Trigger.new) {
    //System.debug('Contract with ID: ', m_contract.size() );
    Contract old_c = Trigger.oldMap.get(c.Id);
    
    System.debug('GIANCAR Contract with Customer Contract ID: ' + m_contract.get(c.Id).Customer_Contract_ID__c );
    System.debug('GIANCAR Contract with Customer Contract Name: ' + m_contract.get(c.Id).Contract_Name_ref__c );

    /*Check if the value has changed, based on the OLD mapping*/
    If (old_c.Contract_Name_ref__c != c.Contract_Name_ref__c) { /*If the value has changed, we update the Customer Contract ID*/
    
        c.Customer_Contract_ID__c = c.Contract_Name_ref__c;
        System.debug('GIANCAR Contract with Customer Contract Name: ' + c.Customer_Contract_ID__c );
    }
}

}

}








 

Dear Team,
we've found the following code of a Case Trigger which emits an error message related to the case owner time zone. I checked the users' time zone both in the SFDC Admin --> Users and also in every single profile in the "My Settings" section. They all have a timezone assigned but for some reason, I believe the bcHelper variable is always NULL and so it triggers the error message.
Where else should I be looking at?

Thank you. 

GC
 

Cannot match case owner's time-zone to
a business hour/holiday record; please update case owner's time-zone in the user profile
 
BusinessHoursUtilities.BusinessHoursHelper bhHelper =
mapBusinessHoursHelpersByUserId.get(c.OwnerId);
if (bhHelper == null) {
c.addError('Cannot match case owner\'s time-zone to
a business hour/holiday record; please update case owner\'s time-zone in
the user profile.');
}

 
Dear Team,
I am creating a email template in VF and I would like to include a link at the bottom. 
The link will ask the customer if the case is resolved or not. Something similar to the bottom of the shot. However, we'd like to ask the customer if the chase is "Resolved" or "not resolved". If the case is "Resolved" is there a way to automatically change the case status to "Need to close" or "Closed" or something which updates a case field.

Thank you.User-added image

Dear All, 
I have a set of records (about 100) of the BCAccount type object. I would need to go through each of them and update the same field with a specific value. 
What's the easiest and fast way to do it having the list of BCAccountId which identify each record?

I was thinking to use Dataloader.

Thank you for your help.

GC

 

Dear All,
I am starting a new project where I would need to access the "Activity History" which is an object accessible from the Account record. I was thinking to create either an APEX class or an Apex Trigger, to be able to access the history and retrieve the information I need. 

Is it possible with Apex to access those objects/records related to the Account record?

Is that the right approach? Is there a quicker way? 

Thank you for your help.
GC


User-added image

Dear All,
I have the following project to develop: when a Case is submitted to us, we have to first-respond it within a certain time (our SLA due date/time). I would like to implement an Apex (trigger or Class?) that fires a notification (an outbound message, or email alert ...) 5 minutes before the SLA due date/time. For example:
a case is created on 05/01/2018 at 8.00AM with priority P1. It must be first responded within 15 minutes that means, at 8.15AM (this is our SLA due date/time). I want to be able to send a notification 5 minutes before we hit the SLA due time. 
The notification (either an outbound message or an email alert) should be sent at 8.10AM, 5 mins before the SLA due date/time: 8.15AM.

I know there are Workflows and time-based action, but would it be more accurate doing in an APEX class? if so? how? 
How can I also repeat the notification many times?

Thank you.
GC

Dear Team,
I need to trigger an APEX Trigger class only to a subset of Cases which oddly my APEX Batch class skipped. 
In my production environment, I have opened the Developer Console window --> Open Execute Anonymous Window and pasted the following code. By calling 'update cc' I will trigger the Case Trigger. However, I get the error in the snapshot.

My questions:
1) How can I run my apex batch class ONLY on the cases that were missed?
2) Is there a way to call the Apex instruction without generating the "Too Many SQL Queries" message?
Thank you.
GC
 
List<case> ccL = [SELECT CreatedDate, Met_SLA_2__c FROM Case WHERE ((CALENDAR_YEAR(CreatedDate) >= 2016) AND (Met_SLA_2__c = null) )];

System.debug('Size List: ' + ccl.size());

for (Case cc: ccL){
    update cc;
}


User-added image


 
Dear All,
I would like to build an Apex Batch which needs to check if the previous value of the 'support package' field is the same as the current value.
Now, I don't have any Trigger in place that saves the previous value. I know that the formula has "PRIORVALUE" function. Is there anything in Apex I can use?

Thank you.
GC
Dear All 
I hope you can help. I implemented and deployed in production already a Case Trigger (let's call it X). X is triggered only by open cases and by any newly open cases. The Case Trigger X, checks the support package and update a field called MET SLA 2, based on first response and support package. 

Now, I want to go back to all the closed cases and trigger X on it. I have been suggested to use an Apex Batch class (see Below). So, I have the questions:
(1) In order for the Apex Batch, the case-trigger X am I right to call the 'update records'? any other solution? am I wrong?

(2) I have built the UnitTest class for the Apex Batch class (see below) and test it. However, I get to cover only 66% and the 'execute' method is not covered and I don't understand why, ... any help?
 
global class MetSLAApexBatch implements Database.Batchable<sObject> {
   
   global Database.QueryLocator start(Database.BatchableContext bc) {
       // collect the batches of records or objects to be passed to execute
       String query = 'SELECT CreatedDate, CaseNumber, Met_SLA_2__c, Met_SLA__c FROM Case WHERE CALENDAR_YEAR(CreatedDate) = 2016 ';
       return Database.getQueryLocator(query);
   }
 
   global void execute(Database.BatchableContext bc, List<Case> records){
       // process each batch of records
      
       update records;
   }    
 
   global void finish(Database.BatchableContext bc){
       // execute any post-processing operations
   }   
}
@isTest
public class UnitTest_MetSLAApexBatch {
    
    static testMethod void testMethod1() {
        List<Case> lstCases = new List<Case>();
        
        for(Integer i=0; i<10; i++){
            Case cc = new Case();
            cc.First_Response__c = System.today();
            lstCases.add(cc);
        }
        
        insert lstCases;
        
        Test.startTest();
            MetSLAApexBatch objClass = new MetSLAApexBatch();
            Database.executeBatch(objClass);
        Test.stopTest();
    }
    
}

Best Regards,
GC


 
Hi Team,

I developed a Case Trigger which will affect all the existing open cases and the new one. However, is there a way to run the trigger to historical cases let say all the cases open and closes 2 months prior the deployment of the trigger in the production environment.

Thank you very much.
GC
Dear All,

I built my first Apex Trigger, as well as the Unit Test class. I cannot find a clear document that tells me what should be the workflow for deploying the Apex trigger and the related Unit Test. 
I have used the ChangeSet method to deploy first the UnitTest and then I will deploy my apex trigger to validate it with the Unit Test (which I hope will pass all the default test).
However, I'm yet unsure if I deploying the UnitTest class is different from deploying any other kind of Trigger/Class

Thank you.
GC
Dear All,

I am not seeing my System.debug messages in the long and I think I have been creating Debug logs session always using the profile in the pic.
This is how configured my trace:
User-added image


User-added image

And these are my logs, it doesn't look that I have reached the 2MB limit, does it?
User-added image

Thank you for your help.
GC
 
Dear All,
I have the following Case Trigger wherein bulk I create an internal list of cases (from the Trigger.new) and an internal list of accounts for each case with their SalesDivision.  
However, I'm confused by the 'for' loop as I get the error messages:

Variable does not exist: Sales_Division__c
DML requires SObject or SObject list type: Map<Id,Account>

Any help? 
Thank you
GC
 
Set<String> setAcountId = new Set<String> ();
for(Case obj: Trigger.New){
	if(obj.AccountId != null){
		setAcountId.add(obj.AccountId);
	}
}
 
//For each Account, find the Sales Division
Map<Id,Account> accWithCaseSalesDiv = new Map<Id,Account>(
	[SELECT Id, Sales_Division__c, (SELECT Id FROM Cases) FROM Account WHERE Id IN : setAcountId 
   ]
);

    for (Map<Id,Account> obj:accWithCaseSalesDiv )  {
        if (String.isEmpty(obj.Sales_Division__c)) {
            obj.Sales_Division__c = 'Americas';
            update obj;
        }
    }   

Map<Id,BusinessHours> accBHID = new Map<Id,BusinessHours>(
	[SELECT Id, name, (SELECT Id FROM Cases) FROM BusinessHours WHERE Id IN : setAcountId 
   ]
);    
Hi Team,

I'm reviewing an Apex Batch job that failed overnight. I would like to update the email address that it sends in case of failure. I cannot figure out where this is built, but I've found this code in the Apex Class. There is a function called 'Label.BatchJobMonitors.split(';')' but I cannot find the definition. The 'toAddresses' is build based on that.
Any help?
Thank you
String status = (String.isEmpty(job.Status)) ? '' : job.Status;
          status = status.toLowerCase();
          ApexClass ac = [SELECT Id, Name FROM ApexClass WHERE Id =: job.ApexClassID];
      String className = ac.Name;
          Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
          String[] toAddresses = Label.BatchJobMonitors.split(';');
          mail.setToAddresses(toAddresses);
          mail.setSubject(subject);

 

Dear Team,
we've found the following code of a Case Trigger which emits an error message related to the case owner time zone. I checked the users' time zone both in the SFDC Admin --> Users and also in every single profile in the "My Settings" section. They all have a timezone assigned but for some reason, I believe the bcHelper variable is always NULL and so it triggers the error message.
Where else should I be looking at?

Thank you. 

GC
 

Cannot match case owner's time-zone to
a business hour/holiday record; please update case owner's time-zone in the user profile
 
BusinessHoursUtilities.BusinessHoursHelper bhHelper =
mapBusinessHoursHelpersByUserId.get(c.OwnerId);
if (bhHelper == null) {
c.addError('Cannot match case owner\'s time-zone to
a business hour/holiday record; please update case owner\'s time-zone in
the user profile.');
}

 
Dear Team,
I am creating a email template in VF and I would like to include a link at the bottom. 
The link will ask the customer if the case is resolved or not. Something similar to the bottom of the shot. However, we'd like to ask the customer if the chase is "Resolved" or "not resolved". If the case is "Resolved" is there a way to automatically change the case status to "Need to close" or "Closed" or something which updates a case field.

Thank you.User-added image

Dear All, 
I have a set of records (about 100) of the BCAccount type object. I would need to go through each of them and update the same field with a specific value. 
What's the easiest and fast way to do it having the list of BCAccountId which identify each record?

I was thinking to use Dataloader.

Thank you for your help.

GC

 

Dear All,
I have the following project to develop: when a Case is submitted to us, we have to first-respond it within a certain time (our SLA due date/time). I would like to implement an Apex (trigger or Class?) that fires a notification (an outbound message, or email alert ...) 5 minutes before the SLA due date/time. For example:
a case is created on 05/01/2018 at 8.00AM with priority P1. It must be first responded within 15 minutes that means, at 8.15AM (this is our SLA due date/time). I want to be able to send a notification 5 minutes before we hit the SLA due time. 
The notification (either an outbound message or an email alert) should be sent at 8.10AM, 5 mins before the SLA due date/time: 8.15AM.

I know there are Workflows and time-based action, but would it be more accurate doing in an APEX class? if so? how? 
How can I also repeat the notification many times?

Thank you.
GC

Dear Team,
I need to trigger an APEX Trigger class only to a subset of Cases which oddly my APEX Batch class skipped. 
In my production environment, I have opened the Developer Console window --> Open Execute Anonymous Window and pasted the following code. By calling 'update cc' I will trigger the Case Trigger. However, I get the error in the snapshot.

My questions:
1) How can I run my apex batch class ONLY on the cases that were missed?
2) Is there a way to call the Apex instruction without generating the "Too Many SQL Queries" message?
Thank you.
GC
 
List<case> ccL = [SELECT CreatedDate, Met_SLA_2__c FROM Case WHERE ((CALENDAR_YEAR(CreatedDate) >= 2016) AND (Met_SLA_2__c = null) )];

System.debug('Size List: ' + ccl.size());

for (Case cc: ccL){
    update cc;
}


User-added image


 
Dear All,
I would like to build an Apex Batch which needs to check if the previous value of the 'support package' field is the same as the current value.
Now, I don't have any Trigger in place that saves the previous value. I know that the formula has "PRIORVALUE" function. Is there anything in Apex I can use?

Thank you.
GC
Dear All 
I hope you can help. I implemented and deployed in production already a Case Trigger (let's call it X). X is triggered only by open cases and by any newly open cases. The Case Trigger X, checks the support package and update a field called MET SLA 2, based on first response and support package. 

Now, I want to go back to all the closed cases and trigger X on it. I have been suggested to use an Apex Batch class (see Below). So, I have the questions:
(1) In order for the Apex Batch, the case-trigger X am I right to call the 'update records'? any other solution? am I wrong?

(2) I have built the UnitTest class for the Apex Batch class (see below) and test it. However, I get to cover only 66% and the 'execute' method is not covered and I don't understand why, ... any help?
 
global class MetSLAApexBatch implements Database.Batchable<sObject> {
   
   global Database.QueryLocator start(Database.BatchableContext bc) {
       // collect the batches of records or objects to be passed to execute
       String query = 'SELECT CreatedDate, CaseNumber, Met_SLA_2__c, Met_SLA__c FROM Case WHERE CALENDAR_YEAR(CreatedDate) = 2016 ';
       return Database.getQueryLocator(query);
   }
 
   global void execute(Database.BatchableContext bc, List<Case> records){
       // process each batch of records
      
       update records;
   }    
 
   global void finish(Database.BatchableContext bc){
       // execute any post-processing operations
   }   
}
@isTest
public class UnitTest_MetSLAApexBatch {
    
    static testMethod void testMethod1() {
        List<Case> lstCases = new List<Case>();
        
        for(Integer i=0; i<10; i++){
            Case cc = new Case();
            cc.First_Response__c = System.today();
            lstCases.add(cc);
        }
        
        insert lstCases;
        
        Test.startTest();
            MetSLAApexBatch objClass = new MetSLAApexBatch();
            Database.executeBatch(objClass);
        Test.stopTest();
    }
    
}

Best Regards,
GC


 
Hi Team,

I developed a Case Trigger which will affect all the existing open cases and the new one. However, is there a way to run the trigger to historical cases let say all the cases open and closes 2 months prior the deployment of the trigger in the production environment.

Thank you very much.
GC