• nazim zmirli
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies
Fairly new to Apex and I have a trigger that checks if a Task is on a Contact and pulls in 2 fields from the Contact record that will update the Task. 

It works fine for one record at a time but when trying to bulk if there are multiple tasks for the same Contact it will only fire for the last Activity in the Trigger.new list and not all that share the same WhoId.

Looks like the Map is only capturing the Contact Id once and then the SOQL query only returns one result. Just need help figuring out the solution so that each Task will get updated with the Contact fields.
 
trigger TaskTrigger on Task (before insert, before update) {

    Map<Id, List<Task>> conIdsMap = new Map<Id, List<Task>>();

    for (Task t : Trigger.new) {
            //Search for Contact on Task
        if (t.whoid != null && t.whoid.getsObjectType().getDescribe().getName() == 'Contact') {
                    List<Task> temp = new List<Task>();
                    temp.add(t);
                    conIdsMap.put(t.whoid, temp);
        }
    }

    if (conIdsMap.size() > 0) {
            for(Contact con : [Select Id, Name, Status__c, Corp_Lead_Score__c from Contact where Id in :conIdsMap.keySet()]) {
                for(Task t :conIdsMap.get(con.Id)){
                    t.Stage__c = con.Status__c;
                    t.Corp_Lead_Score__c = con.Corp_Lead_Score__c;
                }
            }  
        }
}

 
If you are looking for a solution for queries like, how to convert eml to pdf, batch convert eml to pdf, eml to pdf converter software, convert eml to pdf adobe, free conversion of eml file to pdf, eml to pdf converter free download, convert eml to pdf with attachments, how to extract pdf from eml and so on.
In order to solve above queries, I would like to suggest you to try Advik EML to PDF Converter. The tool has the simplest user interface, which makes it easier for users to convert EML to PDF. Even after email conversion process, the attachments remain intact with the pdf file.

How to Batch Convert EML to PDF?
  1. Launch Advik EML to PDF Converter.
  2. Browse and add EML files.
  3. Select Desired Output path.
  4. Click on Convert button.
This is how you can convert multiple EML files to PDF Adobe. 

Hello,
I need a way to create a field on the opporutnity level that looks at the opportunity team members and counts of there are or are not any team members. I can't do this via a rollup field. I tried a formula field but can't find a way to get to the opportunity team level.

Any suggestions?
Thank you.

Hello, 

I am wondering is anyone else has had this problem. When we are refreshing the dashboards, the dashboard just turns to code. It isn't anymore complicated than that. Literally, it is just html tags and styling. Does anyone know why this might be? 

Thanks.

 
Hi all,

We need to implement the following pattern at my org:
  • callout to external data source
  • if that callout takes too long (according to some configurable threshold), log an error (ie do some DML)
  • if that callout timed out on the remote server, try it again
Recognizing the potential for the dreaded "You have uncommitted work pending. Please commit or rollback before calling out." error, I put the error logging code in a future method, thus isolating the DML from the callouts. However, the error is still being thrown. I reduced the issue down to this pattern:
public static void foo() {
    Http http = new Http();
    HttpRequest req = new Httprequest();
    req.setEndpoint('https://test.salesforce.com'); //whatever endpoint
    req.setMethod('GET');
    http.send(req); //works fine
    bar();
    http.send(req); //throws calloutexception
}

@future public static void bar() {

}
Am I correct to assume that calling a future method counts as a DML operation? Is there any documentation I'm missing somewhere?

 
could any one explain even though i wrote standard controlller 
 <apex:page standardController="japan__c" recordSetVar="jap">
    <apex:dataTable value="{!jap}" var="a">
        <apex:column value="{!a.name}" />
    </apex:dataTable>
</apex:page>
User-added image
i am unable to see Visualforce in page layout. do i need enable anything in specific . 
Get Started with Service Cloud

I am trying to add a Case Team Role, but cannot find it in my trailheard org.

any ideas?
Hi,

Are there any best practices when it comes to setting up version control (VC) in conjuction with using the Force.com IDE?

For example, should I make one big project in the Force.com IDE that contains all the meta data on my site and commit that?  Then any new classes or triggers should be a part of this project, and committed to VC?  Would this mean that for every feature I deploy, the entire site would be deployed, instead of just the changes I made?  

I'm curious what everyone else is doing.

Thanks