• Vershley Joyejob
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 11
    Replies
Hello, 

Any ideas on how I can create a map of Task and Contact, like this Map<Task, Contact> by using the WhoId from Task. I already have the Ids of Tasks that should be processed.

Thank you for your help.

Regards,
Vershley
Hello, I have the following class which is called by a simple trigger when the records are updated. We are updating records in Salesforce using an ETL in bulk. However, we noticed that the trigger is not being fired for all records that are being updated.

We do not have any errors that are logged back in the ETL and when we manually go and update the record in Salesforce, the trigger is correctly fired.

Here's the class:
 
public without sharing class Recap_CA {

	private static boolean recursif = false;
	
	public static void calcul_recap_CA(list<finance__c> CAs){
		Utils.Log('calcul_recap_CA : recursif = ' + recursif);

		if (recursif == false){
			recursif = true;

			set<ID> setIdADCs = new set<ID>();
			for(finance__c I : CAs){
				setIdADCs.add(I.Agency_account__c);
			}
			JLC_Utils.Log('calcul_recap_CA : setIdADCs.size = ' + setIdADCs.size());
			
			list<Agency_account__c> ADCs = [select Id,
													Name,
													Somme_CA_annee_n0__c,
													Somme_CA_annee_n1__c,
													Somme_CA_annee_n2__c,
													(select Id,
															Annee__c,
															Somme_montant_HT__c
														from CA_Marge__r)
												from Agency_account__c
												where Id in: setIdADCs];

			Utils.Log('calcul_recap_CA : ADCs.size = ' + ADCs.size());
			for(Agency_account__c ADC : ADCs){
				Integer an = date.today().year();
				ADC.Somme_CA_annee_n0__c = 0;
				ADC.Somme_CA_annee_n1__c = 0;
				ADC.Somme_CA_annee_n2__c = 0;

				for(finance__c CA : ADC.CA_Marge__r){
					if(CA.Annee__c == String.valueOf(an - 0)){
						if(CA.Somme_montant_HT__c != null){
							ADC.Somme_CA_annee_n0__c += CA.Somme_montant_HT__c;
						}
					}else if(CA.Annee__c == String.valueOf(an - 1)){
						if(CA.Somme_montant_HT__c != null){
							ADC.Somme_CA_annee_n1__c += CA.Somme_montant_HT__c;
						}
					}else if(CA.Annee__c == String.valueOf(an - 2)){
						if(CA.Somme_montant_HT__c != null){
							ADC.Somme_CA_annee_n2__c += CA.Somme_montant_HT__c;
						}
					}
				}
			}
			if(ADCs.size() > 0){
				database.update(ADCs);
			}

		}else{
			Utils.Log('calcul_recap_CA : recursif');
		}
	
	}
}

Thank you for your help.

Regards,
 
Hello,

We have the Primary Campaign Source in the opportunity object which is a lookup on the campaign object. I wanted to know if it is possible to have a filter on the lookup so that I can only choose campaigns which have members from the account linked to the opportunity.

I tried several things like creating lookup fields on the campaign member object, but nothing seems to work.

Please help.

Thank you.

Regards,
V.
On a standard page, I want to display a javascript pop-up when saving but only when a specific field has been changed. Can we do that ?
When I create or modify an Account using the UI, nothing should happen. Then I clicked on a custom button on the Account page layout, this sends the modified Account to a WebService.
But when creating or moddifying Accounts in bulk using dataloader, all the accounts should be sent to the WebService.

What are the best ways we could do this ?
NOTE: The Account should only be sent when clicked on the button when using the UI.

Thanks for your ideas.
Hello, 

Any ideas on how I can create a map of Task and Contact, like this Map<Task, Contact> by using the WhoId from Task. I already have the Ids of Tasks that should be processed.

Thank you for your help.

Regards,
Vershley
Hello, community, how to implement this logic: "When a salesforce case is created with a trigger, we create a Trello card in the right list.
trigger onOpportunity_AddPointofContact on Opportunity (after update)
{
 List<Point_of_Contact__c> getPrimaryLst=[select id,Primary__c from Point_of_Contact__c where Primary__c =:true];
    List<Point_of_Contact__c> insertPointConList=new List<Point_of_Contact__c>();
    for(Opportunity opp:Trigger.new)
    {
        Opportunity oldRec =Trigger.oldMap.get(opp.Id);
        if(oldRec.StageName != opp.StageName && opp.StageName == 'Approved')
        {
           Point_of_Contact__c con=new Point_of_Contact__c();
           ngsCon.Point_of_Contact__c=opp.Program_Officer__c;
           ngsCon.Contact__c=opp.npsp__Primary_Contact__c;
           ngsCon.Type__c='grant';
           ngsCon.Start_Date__c=opp.FGM_Base__Award_Date__c;
            if(getPrimaryLst.size() == 0){
             ngsCon.Primary__c =true;   
            }
           insertPointConList.add(ngsCon);
        }
        
    }
    if(insertPointConList.size()>0)
    {
        try {
            insert insertPointConList;
            system.debug('====>insertPointConList'+insertPointConList);
           }
        catch (Exception Ex){
            system.debug(Ex);
        }
    }
 
}

here i wrote the code but record is inserting duplicate records
Hello, 
We had a developer write some code but noticed he left code for the same object in all sorts of places. Wondering if anyone can please let me know what this Apex Trigger is meant to do? 
trigger OpportunityStageTrigger on Opportunity (before insert, before update, before delete, after insert, after update, after delete, after undelete) {
   OpportunityStageTriggerhandler handler = new OpportunityStageTriggerhandler(trigger.new, trigger.old, trigger.newMap, trigger.oldMap, trigger.isInsert,trigger.isUpdate, trigger.isDelete, trigger.isUndelete);
    
    if(trigger.isAfter){
         if(trigger.isUpdate){
            handler.AfterUpdateEvent();
        }
    }
}

 
  • November 13, 2019
  • Like
  • 0
Hello, I have the following class which is called by a simple trigger when the records are updated. We are updating records in Salesforce using an ETL in bulk. However, we noticed that the trigger is not being fired for all records that are being updated.

We do not have any errors that are logged back in the ETL and when we manually go and update the record in Salesforce, the trigger is correctly fired.

Here's the class:
 
public without sharing class Recap_CA {

	private static boolean recursif = false;
	
	public static void calcul_recap_CA(list<finance__c> CAs){
		Utils.Log('calcul_recap_CA : recursif = ' + recursif);

		if (recursif == false){
			recursif = true;

			set<ID> setIdADCs = new set<ID>();
			for(finance__c I : CAs){
				setIdADCs.add(I.Agency_account__c);
			}
			JLC_Utils.Log('calcul_recap_CA : setIdADCs.size = ' + setIdADCs.size());
			
			list<Agency_account__c> ADCs = [select Id,
													Name,
													Somme_CA_annee_n0__c,
													Somme_CA_annee_n1__c,
													Somme_CA_annee_n2__c,
													(select Id,
															Annee__c,
															Somme_montant_HT__c
														from CA_Marge__r)
												from Agency_account__c
												where Id in: setIdADCs];

			Utils.Log('calcul_recap_CA : ADCs.size = ' + ADCs.size());
			for(Agency_account__c ADC : ADCs){
				Integer an = date.today().year();
				ADC.Somme_CA_annee_n0__c = 0;
				ADC.Somme_CA_annee_n1__c = 0;
				ADC.Somme_CA_annee_n2__c = 0;

				for(finance__c CA : ADC.CA_Marge__r){
					if(CA.Annee__c == String.valueOf(an - 0)){
						if(CA.Somme_montant_HT__c != null){
							ADC.Somme_CA_annee_n0__c += CA.Somme_montant_HT__c;
						}
					}else if(CA.Annee__c == String.valueOf(an - 1)){
						if(CA.Somme_montant_HT__c != null){
							ADC.Somme_CA_annee_n1__c += CA.Somme_montant_HT__c;
						}
					}else if(CA.Annee__c == String.valueOf(an - 2)){
						if(CA.Somme_montant_HT__c != null){
							ADC.Somme_CA_annee_n2__c += CA.Somme_montant_HT__c;
						}
					}
				}
			}
			if(ADCs.size() > 0){
				database.update(ADCs);
			}

		}else{
			Utils.Log('calcul_recap_CA : recursif');
		}
	
	}
}

Thank you for your help.

Regards,
 
I have some code a third party put in with zero test coverage.  I do not know how to write test coverage.  Any ideas?  I need 2% more coverage to meet the minimum of 75%.
Hi All,

I have an requirement where i need to set the quote status to 'presented' automatically once the quote pdf is generated and sent via email to customer. how can this be done?
 
The following won't validate, but won't pass the validation in this trail.  Quantity field is howver using the correct field.  Thoughts?

User-added image

<aura:component>

<aura:attribute name="item" type="Camping_Item__c" required="true"/>    
    <ui:outputText value="{!v.item.Name}"/>
    <ui:outputCheckbox value="{!v.item.Packed__c}"/>
    <ui:outputCurrency value="{!v.item.Price__c}"/>
      <ui:outputNumber value="{!v.item.Quantity}"/>
            
</aura:component>
Hello.

I have a problem. I made a visualforce page in order to visualice a related list customiced. I have the following code:

<apex:page standardController="**" extensions="***" showHeader="false" sidebar="false">
    <script type="text/javascript">        
        function redirec(redirectUrl){
            sforce.console.openPrimaryTab(null, redirectUrl, true, '', openSuccess);
        }
    </script>
    <apex:pageBlock rendered="{!**}" > 
        <apex:form >
            <apex:pageBlockTable value="{!***}" var="ret">
                <apex:column >
                     <apex:facet name="header">                      
                         <apex:outputPanel >{!$ObjectType.Account.Fields.***.Label}</apex:outputPanel>
                      </apex:facet>
                    <apex:commandLink target="_top" action="{!URLFOR('/' + ret.***)}">{!ret.***}</apex:commandLink>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Account.Fields.***.Label}" value="{!ret.***}"/>
                <apex:column headerValue="{!$ObjectType.Account.Fields.***.Label}" value="{!ret.***}"/>
                <apex:column headerValue="{!$ObjectType.Account.Fields.***.Label}" value="{!ret.***}"/>
                <apex:column headerValue="{!$ObjectType.Account.Fields.***.Label}" value="{!ret.***}"/>
                <apex:column headerValue="{!$ObjectType.***.Fields.***.Label}" value="{!ret.***}"/>
            </apex:pageBlockTable>             
        </apex:form>
    </apex:pageBlock>
</apex:page>

I visualice it in Salesforce classic (web) and it runs crrectly, but when I visualice in Salesforce1 it becomes with an strange css.

Could you help me? I need o visualice my visualforce page in Salesforce1 but I can't visaulice it correctly. 

Have I use any special labels?

Thanks and best regards,
Hi, I have a created a check box field named "Is Credited". I want to write a validation rule "Is Credited is not true" so I used NOT(Is_Credited__c) but it seems to be wrong. Can anyone help me with the right syntax?