• Meenakshi sinha
  • NEWBIE
  • 25 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
Hi
I am weak in javascript, my requirement is to show a popup in visual force page which will display all account names and I select acocunt name.
I am editing account records.

any help is greatly appreciated.

Thanks
meenakshi​​​​
Hello
Pls let me know what is Trigger.IsExecuting and in what business scenarios can we use it.

Thanks
meenakshi​​​
Hi friends
I have to work on batch apex code .
I have mentioned the ​​entire code.

The scenario is : ​If sales lead does not follow the contacts in 2 days then it is assigned to another user.​
In contact object, custom field called days_since_last_activity. If greater than 2 then records are assigned to another user and email sent.
This is my understanding.

global class UpdateAllContacts implements Database.Batchable<sObject>
 {
   
     //This is the query that is passed to the execute method.  It queries all of the Contacts who have passed the protected period.
    
     String query = 'Select Id, OwnerId FROM Contact WHERE Days_Since_Last_Activity__c > 2';
   
     global database.queryLocator start(Database.BatchableContext BC)
     {
        return database.getQueryLocator(query);
     } //close start method
   
     global void execute(Database.BatchableContext BC, list <Contact> scope)
     {
   
        List <Task> taskList = new List<Task>();
     // Iterate through the whole query of Contacts.
     // Create a Task that's associated with each Contact.  This resets the Days Since Last Activity formula field.
     for(Contact c : scope)
     {
               c.OwnerId = '00590000003s0MYAAY';
               Task tsk = new Task();
               tsk.WhoId = c.Id;
               tsk.ActivityDate = System.today();
               tsk.Status = 'Completed';
               tsk.Subject = 'Ownership Transferred';
   
               taskList.add(tsk);
    
    } //close for-loop
   
     try
     {
        insert taskList;
     }
     catch(exception e)
     {
        System.debug('Tasks not inserted: ' + e);
     }
   
     try
    {
        update scope;
     }
     catch (system.dmlexception e)
     {
        System.debug('Scope not updated: ' + e);
     }
   
     } //close execute method
   
   
     global void finish(Database.BatchableContext BC)
     {
   
     AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed,TotalJobItems, CreatedBy.Email from AsyncApexJob
                       where Id =:BC.getJobId()];
   
     // Create and send an email with the results of the batch.
     Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
   
     mail.setToAddresses(new String[] {a.CreatedBy.Email});
     mail.setReplyTo('batch@mycompany.com');
     mail.setSenderDisplayName('Batch Processing');
     mail.setSubject('Contact Update ' + a.Status);
     mail.setPlainTextBody('The batch apex job processed ' + a.TotalJobItems + ' batches with ' + a.NumberofErrors + ' failures.');
   
     Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
     } //close finish method class
    
} //close global class



global class ScheduleUpdateContacts implements Schedulable
{
    global void execute(SchedulableContext SC)
    {
        UpdateAllContacts uac = new UpdateAllContacts();
       
        database.executebatch(uac);
       
    } //close execute method
   
} //close class

I want to know:
a) If user_A has 1000 contacts under him and he does not follow up in 2 days then how all 1000 records get assigned to another user?
    are we hardcoding the userID
b) are we assigning all 1000 records to single user?
c) ​​​​​​​how do I check if say User_B has been assigned all 1000 records because user_A did not follow since last 2 days?
d) does the system admin transfer ownership to another user:?

please help me out in understandng this.

thanks
meenakshi​​​

Hello
Pls guide me in writing test class for the VF page.
​<apex:page standardController="Account"
           recordSetVar="accounts"
           tabStyle="Account"
           sidebar="false">
 
 <apex:pageBlock title="">
 
   <apex:repeat value="{!accounts}" var="a">
   
  <apex:pageBlockSection title="{!a.Name}"/>
 
  <apex:relatedList list="Contacts"
                    subject="{!a.ID}"
                    id="relatedlist1"
                    title="Contact Info"/>
 
 <apex:relatedList list="Opportunities"
                    subject="{!a.ID}"
                    id="relatedlist2"
                    title="Opportunity Info"/>
                  
</apex:repeat>
 </apex:pageBlock>
           
 
</apex:page>

@istest(SeeAllData=False)
private class MyCls_Test
{
    private static testmethod void testdata()
   {
          Profile p=[Select Id  from profile where name ='System Administrator'];
        
          User u=new User(ProfileId = p.Id, username = 'testmail@org.com', email = 'testuser@gmail.com',
        
                                        EmailEncodingKey = 'UTF-8' , LocaleSidKey = 'en_US',
                                      
                                        LanguageLocaleKey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                                      
                                        alias='cspu',  lastname='lastname');
                
             System.RunAs(u)
            {
         }
}
Thanks
meenakshi​​​​
Hi
Can anyone let me know how we connect salesforce to a webservice to export data / import data?
a) what type of api used?
b) what are the important considerations?

Good example will be helpful in understandng​
Thanks
meenakshi​
Hi all

This is my first post.
a) Please let me know scenarios related​​ to profiles , permission sets , OWD & sharing settings from project perspective.
b) anyone worked on process builder in real time:?
    Please share in brief the scenario.

Thanks
meenakshi​​​​
 

Hello
Pls guide me in writing test class for the VF page.
​<apex:page standardController="Account"
           recordSetVar="accounts"
           tabStyle="Account"
           sidebar="false">
 
 <apex:pageBlock title="">
 
   <apex:repeat value="{!accounts}" var="a">
   
  <apex:pageBlockSection title="{!a.Name}"/>
 
  <apex:relatedList list="Contacts"
                    subject="{!a.ID}"
                    id="relatedlist1"
                    title="Contact Info"/>
 
 <apex:relatedList list="Opportunities"
                    subject="{!a.ID}"
                    id="relatedlist2"
                    title="Opportunity Info"/>
                  
</apex:repeat>
 </apex:pageBlock>
           
 
</apex:page>

@istest(SeeAllData=False)
private class MyCls_Test
{
    private static testmethod void testdata()
   {
          Profile p=[Select Id  from profile where name ='System Administrator'];
        
          User u=new User(ProfileId = p.Id, username = 'testmail@org.com', email = 'testuser@gmail.com',
        
                                        EmailEncodingKey = 'UTF-8' , LocaleSidKey = 'en_US',
                                      
                                        LanguageLocaleKey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                                      
                                        alias='cspu',  lastname='lastname');
                
             System.RunAs(u)
            {
         }
}
Thanks
meenakshi​​​​
Hi
Can anyone let me know how we connect salesforce to a webservice to export data / import data?
a) what type of api used?
b) what are the important considerations?

Good example will be helpful in understandng​
Thanks
meenakshi​