• Susan Taylor
  • NEWBIE
  • 35 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies
I want to write a trigger when user insert or change name(whoid) of task then there is field in task object that has to be change with contact name
trigger taskupdatetrigger on Task (after insert,after update) {
    list<task>tasklist=new list<task>();
    list<contact>contactlist=[select id,name from contact];
       id taskid;
    id contactid;
    for(task taskobj:trigger.new){
        taskid=taskobj.id;
        system.debug('task id'+taskid);
        for(contact conobj:contactlist){
            if(taskobj.WhoId==conobj.Id){
            system.debug('inside if');
            /taskobj.POC_name__c=conobj.Name;
                system.debug('POC_name__c'+taskobj.POC_name__c);
        }
            
        }
        
    }
    system.debug('contactlist'+contactlist);
}

this is giving me error on saving "execution of AfterUpdate caused by: System.FinalException: Record is read-only Trigger.Calendar_trigger: line 12, column 1"
New to Lightning Development and trying to understand its limitations with regards to what works in which environment (Lightning Experience vs Salesforce Mobile). I've added a simple lightning component to the Task layout - it's working fine in Lightning Experience, but does not show in the Salesforce Mobile app's Task layout.  Is this par for the course or is there possibly an attribute I'm missing?
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global">
Many thanks for any advice
I'm taking a course which directed me to this link for reference docs - 
https://<myDomain>.lightning.force.com/auradocs/reference.app

When I go into the UI section and select a component (like inputSelect) then select the Examples tab, no examples are given (the course shows examples available for the component, styling and js).  Same goes for all the UI components from what I've checked.  I've checked in Chrome and Firefox. Any hints/tips?  
Hello,
We have a user account that is tied to automation. We need to deactivate this user as they have not been with the company in about 2 years. 

How can we easily determine what automation if any is associated with  a specific user within our salesforce org.

Thank you.
Hello All

Some line in apex class is not covering please help me.

User-added image



 
public class UpdateAccountManagerEmailAdderss {
        
        public Static void updateAccountMgrEmail(List<case> lstcase)
        {   
         List<String> lstOfDomain=new  List<String>();  
    
         list <Account> lstAccounts = [Select Id,Account_Manager_Email__c from Account WHERE Old_HD_Provider__c!='ConnectWise' AND Status__c='Live'];
          Map<String,String>mapAccount=new  Map<String,String>();
            
            for(account a:lstAccounts){              mapAccount.put(a.id,a.Account_Manager_Email__c); 
      		}
    Map<string,string> mapDomain=new Map<String,String>();
    for(Account ks:[Select id,institutional_EmailDomain__c from Account WHERE Old_HD_Provider__c!='ConnectWise' AND Status__c='Live' and institutional_EmailDomain__c!=null])
    {
        lstOfDomain.add(ks.institutional_EmailDomain__c);
        mapDomain.put(ks.institutional_EmailDomain__c, ks.id);                                                      
                                                                   
        }
       for(case cs:lstcase)
         {
        if(lstOfDomain.size()>0){   
            for(String s:lstOfDomain)
            {  
                if(cs.Description!=null && ( cs.Description).Contains(s))
                {  
                    cs.AccountId=mapDomain.get(s);  
                    cs.Account_Manager_Email__c=mapAccount.get(cs.AccountId);
                   // cs.Identified_Keyword__c=s;
                } 
                else {
                    if((cs.Description).Contains('Test1ymail'))
                    {
                     cs.Account_Manager_Email__c='Test1ymail';   
                    }
                    if((cs.Description).Contains('Test2ymail'))
                    {
                      cs.Account_Manager_Email__c='Test2ymail';  
                    }
                    if((cs.Description).Contains('Test3ymail'))
                    {
                     cs.Account_Manager_Email__c='Test3ymail';   
                    }

                }
               
                       }}}}

}


test class is 


@isTest
public class UpdateAccountManagerEmailAdderss_Test {
    @isTest
    public static void testAcctMgr()
    {
       Map<Id,String> mapAccount =new Map<Id,String>();
       Map<String,String> mapDomain=new Map<String,String>();
        List<string>lstOfDomain=new List<String>();
        Account acc =new Account();
       acc.name='BlackeBeltHelp Agents';
       // acc.Account_Manager_Email__c='test.test@test.com';
        acc.Institutional_EmailDomain__c='ben.edu';
       insert acc;
       mapAccount.put(acc.id,acc.Account_Manager_Email__c);
        mapDomain.put(acc.Institutional_EmailDomain__c,acc.id);
        lstOfDomain.add(acc.Institutional_EmailDomain__c);
       Contact con=new Contact();
       con.accountId=acc.id;
       con.firstName='test';
       Con.lastName='testcontact';
       Con.Email='Shiv@str.tst';
        insert con;
             
        Trigger_Control__c tc=new Trigger_Control__c();
        tc.name='test';
        tc.Enable_Update_Account_Mgr_Email_Trigger__c=true;
        insert tc;
        List<case>lstcase=new List<case>();
        Case cs=new Case();
       
        cs.accountId=acc.id;
        cs.contactId=con.id;
        cs.Account_Manager_Email__c=acc.Account_Manager_Email__c;
        cs.description='kdjksjkfjkjdfsjmk smjkm';
        lstcase.add(cs);
        insert lstcase;
        UpdateAccountManagerEmailAdderss.updateAccountMgrEmail(lstcase);
       
        
    }

}

 
I want to write a trigger when user insert or change name(whoid) of task then there is field in task object that has to be change with contact name
trigger taskupdatetrigger on Task (after insert,after update) {
    list<task>tasklist=new list<task>();
    list<contact>contactlist=[select id,name from contact];
       id taskid;
    id contactid;
    for(task taskobj:trigger.new){
        taskid=taskobj.id;
        system.debug('task id'+taskid);
        for(contact conobj:contactlist){
            if(taskobj.WhoId==conobj.Id){
            system.debug('inside if');
            /taskobj.POC_name__c=conobj.Name;
                system.debug('POC_name__c'+taskobj.POC_name__c);
        }
            
        }
        
    }
    system.debug('contactlist'+contactlist);
}

this is giving me error on saving "execution of AfterUpdate caused by: System.FinalException: Record is read-only Trigger.Calendar_trigger: line 12, column 1"
I'm taking a course which directed me to this link for reference docs - 
https://<myDomain>.lightning.force.com/auradocs/reference.app

When I go into the UI section and select a component (like inputSelect) then select the Examples tab, no examples are given (the course shows examples available for the component, styling and js).  Same goes for all the UI components from what I've checked.  I've checked in Chrome and Firefox. Any hints/tips?  

When creating a new user if you enter the wrong email address, basically an invalid one on accident, how can you correct the email address?

 

The system seems to want to send an email to the user to verify the change, but the email address is bad so what can be done?

 

Thanks...

How do i do the unit testing for this.Unit testing does not go into this part. 

it is not being tested from response.getbody().

We are doing a lot of  json parsing please do help

Shine

 

************Code*******************

JSONParser parser = JSON.createParser(response.getBody());

while (parser.nextToken() != null)
{
if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'total_records'))
{
// Get the value.
parser.nextToken();
// Compute the grand total price for all invoices.
total_records=integer.valueof(parser.getText());
// total_records=
}

 

************Code*******************

Hi,

 

Is there anyway to program the dataLoader to load a field with a static value ?

 

I have a server where different source CSV files will be placed. All this data needs to be loaded into a staging object.

I have a field 'Source System' in the staging object. I need to mark this field with the source system name.

 

What I am trying to do is, to have diffenet beans in my process-conf.xml, each one referring to a different source file and using an appropriate mapping. However, depending on which source I am using, I need to be able to mark the field 'Source System' with a static value. Is there someway to acheive this ?? Like is there some convention in the mapping document with which I can pass static values .. something like.

 

#SFDC = # CSVColumnName

Name = "MySourceSystem"

 

Thanks