• paul dirac
  • 130 Points
  • Member since 2018

  • Chatter
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 37

Hello i have toast messages that display to users based on diffrent rules, i need this test to be translatable / as well as allow overridable by system admins when the managed package is deployed.

I beleave Custom Metadata fields in conjunction with translation workbench will allow this but i have not idea how to retrieve the data in SOQL, could somone give me an example?

when i try the below all i get is an empty entry.

SELECT Label, ExampleNamespace__Ex_example_field__c FROM ExampleNamespace__Ex_example__mdt


for(Apttus_Billing__Invoice__c invoice:invoiceObjectList1) // loop over invoices
                  List<InvoiceLineItems> listToStoreLineItems = new List<InvoiceLineItems>();
                  APTS_InvoiceJournalWrapper invoiceJournWrapper= new APTS_InvoiceJournalWrapper();
                  Decimal Sum=0;
                                    invoiceJournWrapper.AccountingJournalID=String.valueOf(invoice.Name + '_' +myDate);
                                    invoiceJournWrapper.JournalNumber=String.valueOf(invoice.Name + '_' +myDate);
                  list<Apttus_Billing__InvoiceLineItem__c> invlineitems=[Select id,Apttus_Billing__AssetLineItemId__r.Apttus_Config2__ProductId__r.ProductCode,Apttus_Billing__AssetLineItemId__r.Apttus_Config2__OptionId__r.ProductCode,Apttus_Billing__InvoiceId__r.Name,Apttus_Billing__ProductId__r.Name,Apttus_Billing__InvoiceId__r.CurrencyIsoCode,
                                                             from Apttus_Billing__InvoiceLineItem__c where Apttus_Billing__InvoiceId__c=:invoice.id and Apttus_Billing__Type__c='Contracted' and Apttus_Billing__Amount__c!=0];
                   InvoiceLineItems FirstInvItems= new InvoiceLineItems();

Hi All, 

I am new to Salesforce and I am trying to develop an application where I created a custom object called Commissions which is related to the Contact object via Master-Detail relationship (Contact being the master). I created a custom checkbox in the Contact object which should be checked if the Contact has the most commissions within the Account where they belong to. I created a rollup field for this. 
My task is to create a trigger which automatically checks the custom checkbox if the contact is the contact who has the most commissions. I managed to create a working trigger however it only seems to execute after I add a commission for the second time, even though they have the biggest commission after the first addition already. I assume it has something to do with when the trigger is triggered but I can't figure out how to correct the code. Any help is appreciated. 
Here is my code: 
trigger UpdateContactOnCommissionUpdate on Commission__c ( after insert, after update, before insert, before update) {
    double maxCommission=0;
    Id ContactId;
    Id AccId;
    for(Commission__c comm:Trigger.new){
    System.debug('Contact id: '+ContactId);
    List<Contact> contacts=[SELECT AccountId FROM Contact WHERE Id=:ContactId];
    System.debug('Account ID: '+contacts.get(0).AccountId);
    List<Contact> contactsToUpdate = new List<Contact>{};
    for(Contact c:[SELECT Id, Total_Commission__c, Primary__c FROM Contact WHERE AccountID=:AccId]){
    System.debug('Maximum commission'+ maxCommission);
    for(Contact c:contactsToUpdate){
    if(contactsToUpdate != null && !contactsToUpdate.isEmpty())

I had a developer re-write an Apex Class.  Now I need to disable a trigger that I already had in Production that runs another Apex Class.  Can someone tell me how to change this trigger so that I can deploy it but it won't do anything?
* Name        - OpportunityTriggerLargeAwards
* Description - Opportunity Trigger for Large Awards
* Modification Log :
* ---------------------------------------------------------------------------
* Developer             Date            Description
* ---------------------------------------------------------------------------
* jmasters             11-08-2016      Created 
trigger OpportunityTriggerLargeAwards on Opportunity (after delete, after insert, after undelete, 
after update, before delete, before insert, before update) {
   OpportunityTriggerHandlerLargeAwards handler = new OpportunityTriggerHandlerLargeAwards(true);

    /* Before Insert */
    if(Trigger.isInsert && Trigger.isBefore){
    /* After Insert */
    else if(Trigger.isInsert && Trigger.isAfter){
        handler.OnAfterInsert(Trigger.new, Trigger.newMap);
    /* Before Update */
    else if(Trigger.isUpdate && Trigger.isBefore){
        handler.OnBeforeUpdate(Trigger.old, Trigger.new, Trigger.oldMap, Trigger.newMap);
    /* After Update */
    else if(Trigger.isUpdate && Trigger.isAfter){
        handler.OnAfterUpdate(Trigger.old, Trigger.new, Trigger.newMap, Trigger.oldMap);
    /* Before Delete */
    else if(Trigger.isDelete && Trigger.isBefore){
        handler.OnBeforeDelete(Trigger.old, Trigger.oldMap);
    /* After Delete */
    else if(Trigger.isDelete && Trigger.isAfter){
        handler.OnAfterDelete(Trigger.old, Trigger.oldMap);
    /* After Undelete */
    else if(Trigger.isUnDelete){


I'm getting this error, but when I try to open a record it's not there.

Hello i have toast messages that display to users based on diffrent rules, i need this test to be translatable / as well as allow overridable by system admins when the managed package is deployed.

I beleave Custom Metadata fields in conjunction with translation workbench will allow this but i have not idea how to retrieve the data in SOQL, could somone give me an example?

when i try the below all i get is an empty entry.

SELECT Label, ExampleNamespace__Ex_example_field__c FROM ExampleNamespace__Ex_example__mdt


I have the following code snippet in a Helper class that's being called by an After Insert trigger (modified to demonstrate my objective):
Set<Id> reuseIds = new Set<Id>();

List<ContentDocumentLink> allLinks = [SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN :reuseIds];

System.debug('allLinks size: ' + allLinks.size());

The debug output is showing me that I'm getting zero results. However, when I run the same query in the debug console, I see the single row returned that I'm expecting.

I have included without sharing on the trigger Helper class even though my understanding is that's not necessary in a trigger, but it doesn't change my results.

Can anyone offer any clues as to what I may be experiencing here?
Hello Everyone

I need some help and suggestion regarding the email alert when lead is not modified for 24 Hrs, i tried with the workflow alert and time based Triggers but it was not working, 
Workflow rule:-

Evaluation criteria:- Every time record is created & subsequently meet criteria

Formula:- LastmodifiedDate=Created Date

and Created a Timetrigger actions for 24 Hrs, but it did not fire

I have Faced a lot of issues with Workflows and Prosess Builders, so i need help for designing a Batch class When Lead  is Created and if the lead is not modified for 24Hrs it should send an Email alert
This is what i have come up with till now
global class Emailalertbatchclass implements Database.Batchable<sObject>, Schedulable, Database.Stateful {

    //Variable Section
    global FINAL String strQuery;
    global List<String> errorMessages = new List<String>();
    global Emailalertbatchclass() { 
        this.strQuery = getBatchQuery();
    //Returns the Query String to Batch constructor to fetch right records.
    private String getBatchQuery() {
        String strQuery = 'SELECT Id, name, Owner.Email FROM Lead WHERE CreatedDate >= YESTERDAY'; 
        return strQuery;
    //Batch Start method
    global Database.QueryLocator start(Database.BatchableContext BC) {
        return Database.getQueryLocator(strQuery);

    //Batch Execute method calls findCostForWoD method
    global void execute(Database.BatchableContext BC, List<sObject> scopeList) {
        System.debug(LoggingLevel.INFO, '== scopeList size ==' + scopeList.size());
        List<Lead> ld = (List<Lead>) scopeList;
        if(!ld.isEmpty()) { 
            List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
            for (Lead prod : ld)
                Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage(); 
                String[] toAddresses = new String[] {prod.Owner.Email};
                Message.SaveAsActivity = false;
            if(!mailList.isEmpty()) {
                catch (Exception ex) {
                    errorMessages.add('Unable to send email to Tech: '+ ex.getStackTraceString());

    //Batch Finish method for after execution of batch work
    global void finish(Database.BatchableContext BC) { 
        AsyncApexJob aaj = [Select Id, Status, NumberOfErrors, JobItemsProcessed, MethodName, TotalJobItems, CreatedBy.Email from AsyncApexJob where Id =:BC.getJobId()];
        // Send an email to the Apex job's submitter notifying of job completion.
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {aaj.CreatedBy.Email};
        mail.setSubject('JOB Salesforce Send Notification Batch: ' + aaj.Status);
        String bodyText='Total Job Items ' + aaj.TotalJobItems + ' Number of records processed ' + aaj.JobItemsProcessed + ' with '+ aaj.NumberOfErrors + ' failures.\n';
        bodyText += 'Number of Error Messages ' + errorMessages.size() + '\n';
        bodyText += 'Error Message' + String.join(errorMessages, '\n');
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    //Method which schedules the ProductDownloadBatch
    global void execute(SchedulableContext sc) {        
        Emailalertbatchclass snInstance = new Emailalertbatchclass();
        ID batchprocessid = Database.executeBatch(snInstance);
Any help would be Highly Appericiated 


I am trying to log the exceptions in an custom object ,but after throwing an exception entire transaction is rolled back and i am not able to see in the custom objecy any help would be if great help  for example 

List<IBA_Store_Log__c> ibaLogs = New List<IBA_Store_Log__c>(); 
try {
    integer x = 1/0;
} catch (exception e) {
     IBA_Store_Log__c priceLog = IBA_store_datatableHelper.createIbaLog('ERROR', e.getmessage() + e.getlinenumber(), 'Iba_Store_Sap_Simulation', '');
    throw e;
}finally {
A.Long myLevel = acct . Level _c;
B. Decimal myLevel = acct .Level_c
C. Integer myLevel = acct .Level _c;
D. Object rayLevel = acct . Level _C;
E. Double myLevel = erect .Level _c
B,D,E which are correct
how can a developer get the label for the stageName field?
A. Call "Opportunity.StageNamelabel";.
B. Call "Opportunity.StageName.getDescribe0.getLabel()"
C. Call -opp.StageName.getDescrIbe0.getLabel()"
D. Call opp.StageName.Label
I'm in a little bit of struggle here. Have an error in this class. I tried to debug log this error but I don't understand why only one user is having this problem. For the rest of the users this error does not occur. This is the error:
Visualforce Page: /apex/VisitReportPage

caused by: System.NullPointerException: Attempt to de-reference a null object Class.VisitReportPageExtension.setIsFullReport: line 105, column 1 Class.VisitReportPageExtension.: line 65, column 1

This is my class:


public with sharing class VisitReportPageExtension {

    public List<SelectOption> PicklistValues { get; set; }
    public List<SelectOption> SecondPicklistValues { get; set; }
    public List<SelectOption> LastPicklistValues { get; set; }
    public Map<String, String> PicklistMap = new Map<String, String>();

    Public List<String> selectedValues { get; set; }
    Public List<String> SecondselectedValues { get; set; }
    public List<String> LastSelectedValues { get; set; }

    public static final String DEFAULT_TASK_STATUS = 'New';
    public static final String DEFAULT_TASK_PRIORITY = 'Normal';

    public static final String EVENT_URL_PARAM = 'EventID';
    public static final String RETURN_URL_PARAM = 'retUrl';
    public static final String RECORD_TYPE_URL_PARAM = 'RecordType';
    public static final String ACCOUNT_URL_PARAM = 'AccountId';
    public static final String OPPORTUNITY_URL_PARAM = 'OpportunityId';

    public static final String MEMO_REPORT_DEVELEOPER_NAME = 'Call_Memo';

    private List<List<String>> contactFields;
    private Map<ID, Contact> contactsCache = new Map<ID, Contact>();
    private Map<ID, User> userCache = new Map<ID, User>();
    private List<Message> messages = new List<Message>();
    private Map<Id, RecordType> mInteractionReportRecordTypes = null;

    private boolean isFullReport = true;
    private String retURLParam = null;

    public Boolean isNew { get; private set; }
    public Boolean showCreateContactPopup { get; set; }

    public List<ActionItemWrapper> actionItems { get; set; }
    public List<CustomerParticipantWrapper> customerParticipants { get; set; }
    public List<CustomerParticipantWrapper> internalParticipants { get; set; }
    public Contact contactHandler { get; set; }

    public Visit_Report__c record { get; set; }

     * Constructor creates instance of class. Loads Interaction 
     * report and related records.
     * @param  stdCtr Standard controller.
    public VisitReportPageExtension(ApexPages.StandardController stdCtr) {
        customerParticipants = new List<CustomerParticipantWrapper>();
        internalParticipants = new List<CustomerParticipantWrapper>();

        record = (Visit_Report__c) stdCtr.getRecord();
        isNew = (stdCtr.getId() == null);

        mInteractionReportRecordTypes =


        selectedValues = new List<String>();
        SecondselectedValues = new List<String>();
        LastSelectedValues = new List<String>();

        PicklistValues = new List<SelectOption>();
        SecondPicklistValues = new List<SelectOption>();
        LastPicklistValues = new List<SelectOption>();
        List<Schema.PicklistEntry> FieldPicklistvalues =

        for (Schema.PicklistEntry FieldPicklistvaluesfor : FieldPicklistvalues) {
            PicklistValues.add(new SelectOption(FieldPicklistvaluesfor.getValue(),

    private void loadParams() {
        Map<String, String> mGetParams = ApexPages.currentPage().getParameters();
        record.EventID__c = mGetParams.get(EVENT_URL_PARAM);
        retURLParam = ApexPages.currentPage().getParameters().get(RETURN_URL_PARAM);

        //TODO get rec type 
        if (record.RecordTypeId == null) {
            if (mGetParams.containsKey(RECORD_TYPE_URL_PARAM)) {
                record.RecordTypeId = mGetParams.get(RECORD_TYPE_URL_PARAM);
        if (mGetParams.containsKey(ACCOUNT_URL_PARAM)) {
            record.Account_Name__c = mGetParams.get(ACCOUNT_URL_PARAM);

    private void setIsFullReport(Id recordTypeId) {
        isFullReport = (mInteractionReportRecordTypes.get(recordTypeId).DeveloperName != MEMO_REPORT_DEVELEOPER_NAME);

    public boolean getIsFullReport() {
        return isFullReport;

Why this error only occurs for only one user? I don't know why the code breaks. Any suggestions?