• Arvind Kumar
  • SMARTIE
  • 863 Points
  • Member since 2017
  • Salesforce Developer
  • Persistent Systems Limited

  • Chatter
    Feed
  • 23
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 166
    Replies
I am having trouble while creating this app page. I am not able to practice this step
9. In the properties pane for the Recent Items component, click Select and add the Opportunity object to it.
After clicking on Select I can't see opportunity option anywhere.
Am I doing sth wrong ?
Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c]

Here is the thing I need to complete
Field-Level Security— 1.Customer SSN and Bank Account fields on contact records must be encrypted.
2. Any change in the Amount field on opportunity records must be recorded.
I have completed first part. Do I have to create a fromula field for on opportunity object ?
 
  1. @isTest
  2. public class OpportunityOwnerUpdate_test {
  3.     
  4.     static testMethod void data1(){
  5.         List<Opportunity> Opportunitys = new List<Opportunity>();
  6.         Opportunity a = New Opportunity();
  7.         a.Name = 'myOpportunity';
  8.         a.StageName='Stage 1 - Expressed Interest';
  9.         a.CloseDate=date.today();
  10.         Opportunitys.add(a);
  11.         insert Opportunitys;
  12.          
  13.     
  14.         ApexPages.StandardSetController  sac = new ApexPages.StandardSetController (Opportunitys);
  15.         sac.setSelected([SELECT Id, OwnerId FROM Opportunity LIMIT 2]);
  16.         OpportunityOwnerUpdate aop = new OpportunityOwnerUpdate(sac);
  17.         aop.isSelected = true;
  18.         
  19.       
  20.      aop.updateOpportunity();
  21.              
  22.     }
  23.     
  24.    static testMethod void data2(){
  25.         List<Opportunity> Opportunitys = new List<Opportunity>();
  26.         Opportunity a = New Opportunity();
  27.         a.Name = 'myOpportunity';
  28.         a.StageName='Stage 1 - Expressed Interest';
  29.         a.CloseDate=date.today();
  30.         Opportunitys.add(a);
  31.         insert Opportunitys;
  32.          
  33.     
  34.         ApexPages.StandardSetController  sac = new ApexPages.StandardSetController (Opportunitys);
  35.         OpportunityOwnerUpdate aop = new OpportunityOwnerUpdate(sac);
  36.         aop.isSelected = false;
  37.     }
  38. }
I want to know about the preparation and skills required to clear the platform developer 2 certification in salesforce. I'm 2 years experienced in salesforce.

Thanks and Regards,
Shiva RV
Hi All - I was so excited I was able to create this very "simple" trigger (so new to this) and when I went to deploy it to Prod I received a 0% Code Coverage error. Could someone please help me understand this code coverage madness and what I actually need to do? Is it an Apex Class? I'm so lost...any help is much appreciated, my trigger below for reference.

trigger AttachmentCount on Attachment (after insert)
{

List<lead> co = [select id, Attachment_Added__c from lead where id =:
Trigger.New[0].ParentId];
if(co.size()>0)
{
co[0].Attachment_Added__c = True;
update co;
}
}
Now I created new page having sections of Account and Task and created two buttons and now the conditions are " if you click on Save with task button it should create record in account and display in related list (Open Activities) and if you click on Save Without task button it should create Account record but not Task (Open Activities) record."

How will I achieve this functionality?
 
global class updatesaccount implements 
    Database.Batchable<sObject>, Database.Stateful
{
    global Integer recordsProcessed = 0;

   global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator(
            'SELECT ID, Phone, ' +
            'Fax, (SELECT ID, Phone, ' +
            'Fax FROM Contacts) FROM Account ' + 
            'Where Industry = \'Construction\''
        );
    }

    global void execute(Database.BatchableContext bc, List<Account> scope ){
        
      List<Contact> contacts = new List<Contact>();
        for (Account account : scope) {
            for (Contact contact : account.contacts) {
                contact.Phone = account.Phone;
                contact.Fax = account.Fax;
             
               
                
                contacts.add(contact);
               
                recordsProcessed = recordsProcessed + 1;
            }
        }
        update contacts;
    }    

    global void finish(Database.BatchableContext bc){
        System.debug(recordsProcessed + ' records processed. pradeepvarma');
        AsyncApexJob job = [SELECT Id, Status, NumberOfErrors, 
            JobItemsProcessed,
            TotalJobItems, CreatedBy.Email
            FROM AsyncApexJob
            WHERE Id = :bc.getJobId()];
       
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
          String[] toAddresses = new String[] {'pradeep.gunturi@gmail.com'};
               mail.setSubject('Match Merge Batch ');
            mail.setPlainTextBody('hi pradeep batchapex completed');
         mail.setToAddresses(toAddresses);
       List<Messaging.SendEmailResult> sendRes = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }, true);
        
       
    }    

}


i want copy phone and fax of account whos industry is construction

but when ever we create new contact its sshowing whats problem in prgrm
Hi Friends,
I have code coverage issue while writing a test class for the trigger. One line is not passed the code coverage I did not find the reason, why it is not .Can any one suggest me the reason. I am getting 87% code coverage.
Trigger:
trigger AccountsProcessorTrig on Account (after insert) {
    if(trigger.isInsert){
       AccountProcessor.countContacts(trigger.newMap.keySet()); 
    }
}
Apex Class:
public class AccountProcessor {
    public static integer count=0;
@future
    public static void countContacts(set<Id> accountids){
        List<Account> accountstobulkify=[SELECT Id, Name FROM Account WHERE Id IN:accountids];
        Map<Id,Account> accountstoupdate=new Map<Id,Account>();
        for(Account a:accountstobulkify){
            for(Contact c:a.Contacts){
                count=count++;// this line is not passed
            } 
        a.Number_Of_Contacts__c=count;
        }
        
     }


Test class:
@isTest
private class AccountProcessorTest {
@isTest
    static void CountNoOfContacts(){
        Account testacc=new Account(Name='Numberofcontactstest',Industry='Finance');
        insert testacc;
        List<Contact> testlist=new List<Contact>();
        for(integer i=0; i<10; i++){
            Contact testcon=new Contact(LastName='AccountContact'+i, AccountId=testacc.id);
            testlist.add(testcon);
        }
        insert testlist;
        system.debug('size:'+testlist.size());
        Map<Id,Account> testids=new Map<Id,Account>([SELECT Id, Name, Number_Of_Contacts__c FROM Account WHERE Name=:'Numberofcontactstest']);
        Set<Id> accids=testids.keySet();
        system.debug('Contcts:'+([SELECT Count() FROM Contact WHERE AccountId=:testacc.Id]));
        test.startTest();
        AccountProcessor.countContacts(accids);
        test.stopTest();
        decimal a=[SELECT ID, Name FROM Account WHERE Name=:'Numberofcontactstest'].Number_Of_Contacts__c;
        system.assertEquals(10, a);
    }
}
 
Hi all,

Is there a way to create a custom button to link directly to the salesforce standard page for deleting a case? I'm unable to add the standard button to the case detail page on a feed view so we have to go to a different view on the case to delete it.

Alternatively is there a standard code for deleting a case
Need to change the default case owner to a blank field until we figure out the default user or queque. 
I have to pull up lead or contact info in HTML email template.
Can someone explain me what's this mean %%first_name%% , %%view_online%%
%%Oraganization%%

I need to replace value in Salesforce with above info.
Hi,

I am getting the following error in my batch class start method klet me know whats the issue

Error: Compile Error: Method does not exist or incorrect signature: Database.QueryLocator(List<Contract__c>) at line 10 column 16


global class BatchTriggerHandler implements Database.Batchable<sObject> {
Set<Id> contractIdSet = new Set<Id>();

    // Constructor will take set of new Contract IDs
    global BatchTriggerHandler(Set<Id> contractIdSet){
        this.contractIdSet = contractIdSet;
    }
 global Database.QueryLocator start(Database.BatchableContext bc) {
        // Query all Contract records that were in Trigger.new
        return Database.QueryLocator([SELECT Status__c, Account__c FROM Contract__c WHERE Id IN :contractIdSet]);
    }


let me know whats the issue 

Kindly help me

thanks


 
Hello Everyone,

I need to create a validation rule to not allow the Close Date be changed : ISCHANGED( CloseDate )
if it is from a previous fiscal year (2016 and earlier) and the stage is in Closed-Won: ISPICKVAL(StageName, 'Closed – Won')

UNLESS it is done by either Profile IDs:
     $User.ProfileId = "00ew0000001R9Bh",
        $User.ProfileId = "00ew0000001R98E"

Any assistance would be appreciated!

Thank you,
Julia
Hi all ,
Actually I'm trying to complete Battle Station App in Trailhead.When I verify the Step:Modify  The User Experience in Battle Station App.I got this error.

There was an unhandled exception. Please reference ID: CMRDWFAY. Error: Faraday::ResourceNotFound. Message: NOT_FOUND: The requested resource does not exist

So,Please Any Refer My ID


Thanks 
Venkatesh Puttam
Hello,

foa approval process, user still get option to selete user to select.

I created a approval process for Quote.
I got the option for first time but the option no more appears when i try to clone or create a new approval process on Quote

I dont have below option to edit.

User-added image

thank you for suggestion
I was completing the hands-on challenge for Workflow Rule Migration > Map Your Workflow Criteria to Process Criteria and checking the challenge I get the below error. I already tried to use a new trailhead playgroud but I'm still getting the same error. Can you please assist.

Thanks and regards.

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: NLBSTXKH
Hi,

I am using Outlook to Salesforce configuration.  I have configured both ways syncing.

Issue: If I am deleting the event from outlook then Salesforce event is deleting automatically.

I want: if I have deleted the event into outlook. It should not be deleted from Salesforce database.
OR
Can I fix this issue on Outlook end? Can I hide the delete button on Outlook page for the event?

Please help me.

Thanks,
Arvind Kumar
Hi,

Please give me solution for header & footer coloring for Customer portal page layout.

I have attach screen shot for better help.

Customer Portal Page

Thanks in advance,
Arvind Kumar
Here is the situation if Account's Laptop delivered lapp_c is not null then create a task related to it in the account through apex class.

Any idea ?
 
Hi, I have to update contacts deaily if a custom number field call_interval_count with number 1 if call_interval_c !=  null. 
My batch is below:
global class updatecontactworkflow implements Database.Batchable<SObject>, Database.Stateful{
             
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'Select Id, Call_Interval__c From contact WHERE Call_Interval__c != Null';
        system.debug(query);
        return Database.getQueryLocator(query);
    }
     
    global void execute(Database.BatchableContext BC, List<SObject> scope){
        for(contact obj : (contact[]) scope){
            if(obj.Call_Interval__c != Null){
               obj.Call_Alert_Count__c = 1;
              } else 
               obj.Call_Alert_Count__c = 1;
            }
        system.debug('list to be updated size  :: ' + scope.size());
        if(!scope.isEmpty())
        {
              update scope;
         }
     }

    global void finish(Database.BatchableContext BC){
    }
}

and test class is :
@isTest             
private class updatecontactworkflowTest 
{
    static testmethod void testbatch() 
    {
        Account acc = new Account(Name='Test Account');
        insert acc;
              
        List<contact> cons = new List<contact>();
        for (integer i=0; i<50; i++)
        {
            contact con = new contact();
            con.AccountId=acc.Id;
            con.Name='My contact'+i;
            con.Level__c ='C Level';
            con.Functional_Role__c = 'Opeartion';
            con.Title = 'CFO';
			con.Phone = '+441569172306';
			con.Email = 'na@na.com';
			con.Call_Alert_Count__c = '1';
			
            //con.LastActivityDate = System.today()+15;
            cons.add(con);
        }
        insert cons;
        
       Test.startTest();
           updatecontactworkflow  obj = new  updatecontactworkflow ();
           Database.executeBatch(obj, 200);
       Test.stopTest();

    }
}

Code Coverage is 46% (6/13). Please assist :)
Challenge Not yet complete... here's what's wrong: 
The Lead and Contact records with the last name 'Smith' were not found. Please add these records for this challenge.

I have created a Lead and Contact Record with last name 'Smith' , but I am still getting this error message on trailhead.

Below is my code:
public class ContactAndLeadSearch {

   
    public static List<List<SObject>> searchContactsAndLeads(String str)
    {
        List<List<sObject>> searchContactsAndLeadsList = [FIND :str IN Name FIELDS RETURNING Contact(FirstName,LastName) ,Lead(FirstName,Lastname)];
        system.debug(searchContactsAndLeadsList);
        
        

        return searchContactsAndLeadsList;
        
    }


}

Kindly assist.
Regards,
​Sejal 
I am having trouble while creating this app page. I am not able to practice this step
9. In the properties pane for the Recent Items component, click Select and add the Opportunity object to it.
After clicking on Select I can't see opportunity option anywhere.
Am I doing sth wrong ?
The requirement is that I am able to see the Opportunity Amount populated with the roll-up amount from Opportunity Line Items and the original Estimated Amount value cannot be modified when a quote exists so that I can manage my pipeline. My question is how would I create a Opportunity validation rule with related quote? An example would be great!
I have used below formula

IF( OR( VALUE( MID( TEXT(CreatedDate + 10), 12, 2 ) ) = 0, VALUE( MID( TEXT( CreatedDate + 10), 12, 2 ) ) = 12 ), "12", TEXT( VALUE( MID( TEXT( CreatedDate + 10), 12, 2 ) ) - IF( VALUE( MID( TEXT( CreatedDate + 10), 12, 2 ) ) < 12, 0, 12 ) ) ) & ":" & MID( TEXT( CreatedDate + 10), 15, 2 ) & " " & IF( VALUE( MID( TEXT( CreatedDate + 10), 12, 2 ) ) < 12, "PM", "AM" )

But actual time is 7:33 PM   and it is showing  9:33 PM , I have tried to modification on above forumla it is showiing same time as 9:33PM  may i know where is the issue ?
 
can any one tel me can i increase the limit for the help text
which is by default 255 characters
Hi,
I want to create a workflow to stop deactivating a USer if he/she is linked to a Territory.

For instance, a CDM who stopped working at my org and I need to create a workflow to stop deactivating him/her if the CDM is linked to Territory.

Could anyone please help me as this is urgent.Please see my below workflow.
I am trying to include the Workflow as Territory:CDM equals to True,
Territory Owner is not equal to Deactivate.
The above workflow is not wrking. could someone help me out please?
I cannot complete Trailhead Unit 1, and continue to receive the below error message:Challenge Not yet complete... here's what's wrong:  The 'Trailhead_Data_Manager' app was not found. Please follow the requirements and ensure the wave enabled org is setup correctly.
I am tryin to do a module and it is telling me to go to my trailhead playground and click the cog for me setup.....
A) How do I know that I am in the playground?
B) I've logged into trailhead but do not see a cog for setup?
C) How can I be sure I am not in production?
Hi All - I was so excited I was able to create this very "simple" trigger (so new to this) and when I went to deploy it to Prod I received a 0% Code Coverage error. Could someone please help me understand this code coverage madness and what I actually need to do? Is it an Apex Class? I'm so lost...any help is much appreciated, my trigger below for reference.

trigger AttachmentCount on Attachment (after insert)
{

List<lead> co = [select id, Attachment_Added__c from lead where id =:
Trigger.New[0].ParentId];
if(co.size()>0)
{
co[0].Attachment_Added__c = True;
update co;
}
}
global class updatesaccount implements 
    Database.Batchable<sObject>, Database.Stateful
{
    global Integer recordsProcessed = 0;

   global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator(
            'SELECT ID, Phone, ' +
            'Fax, (SELECT ID, Phone, ' +
            'Fax FROM Contacts) FROM Account ' + 
            'Where Industry = \'Construction\''
        );
    }

    global void execute(Database.BatchableContext bc, List<Account> scope ){
        
      List<Contact> contacts = new List<Contact>();
        for (Account account : scope) {
            for (Contact contact : account.contacts) {
                contact.Phone = account.Phone;
                contact.Fax = account.Fax;
             
               
                
                contacts.add(contact);
               
                recordsProcessed = recordsProcessed + 1;
            }
        }
        update contacts;
    }    

    global void finish(Database.BatchableContext bc){
        System.debug(recordsProcessed + ' records processed. pradeepvarma');
        AsyncApexJob job = [SELECT Id, Status, NumberOfErrors, 
            JobItemsProcessed,
            TotalJobItems, CreatedBy.Email
            FROM AsyncApexJob
            WHERE Id = :bc.getJobId()];
       
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
          String[] toAddresses = new String[] {'pradeep.gunturi@gmail.com'};
               mail.setSubject('Match Merge Batch ');
            mail.setPlainTextBody('hi pradeep batchapex completed');
         mail.setToAddresses(toAddresses);
       List<Messaging.SendEmailResult> sendRes = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }, true);
        
       
    }    

}


i want copy phone and fax of account whos industry is construction

but when ever we create new contact its sshowing whats problem in prgrm
Hi All,

i am new in apex code i write a trigger and dont have idea about the handler class so i directly write logic in trigger itself. it would be great if anybody let me know how to write handler class and call this trigger code. 
trigger Lookupuserrecord on Account (before insert, before update) {
        
        Set<Id> ParentIds = New Set<Id>();
        For(Account Acc : Trigger.New)
    {
        ParentIds.Add(Acc.Master__c);
    }
       List<Master__c> ParentList = [Select Id,test_user1__c from Master__c where id =: ParentIds];
       
       For(Account CO : Trigger.New)
    {    
        For(Master__c PA : ParentList)
        {
            IF(CO.Master__c == PA.ID)
            {
                IF(PA.test_user1__c != NULL)
                {
                    CO.test_user1__c = PA.test_user1__c ;
                }
            }
        }
    }    
       
        
}