• Bhupathi Yadav
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 3
    Replies
Hi ,

I am getting the following compile error when saving the apex class
Compile Error: Invalid type: parkService.parksImplPort at line 3 column 1
And find below code:
public class ParkLocator{
public static String[] country(String country){
parkService.parksImplPort park= new parkService.parksImplPort();
String[] parksname = park.byCountry(country);
return parksname;
 }
}
User-added image
Hi,
I'm getting the following error when checking challenge for 'Improve Navigation in the Sales App and Create a Chatter Group' step.
--> I tried by creating new playground and new DE to check challenge still i am getting same error User-added image

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: FLIDMDVS
User-added imageAny resason why its taking as null.
Code whre i am hard coding the value:
User-added image
I am using few custom labels in in my class i have to cover code coverage for that

            /* fetch required properties from custom labels*/\

            Storefront=System.Label.RLWS_CL_EmbTrack_Storefront;
            LOGO=System.Label.RLWS_CF_Logo;
            UniversalLogo=System.Label.RLWS_CF_Universal_Logo;
            UniversalLogoPrice=System.Label.RLWS_CF_Universal_Logo_Price;
            
            currencies = [Select label from RLWS_Obj_Currency__mdt Limit 100];

Can you please tel how to cover this area
 
Error element myRule_1_A1 (FlowActionCall).
An Apex error occurred: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: [objectId]: [objectId]
This is mycode

Public class OrderApprvlUtility
{
   
     @InvocableMethod
    public static void submitForApproval(List<ccrz__E_Order__c> ordids)
    {
       set<id> orderidsset=new set<id>();
        for(ccrz__E_Order__c Ordr:ordids)
        {
            orderidsset.add(Ordr.id);  
        }
     system.debug(' Inside approval--->' +ordids);
      List<ccrz__E_Order__c> orderList=[select id,createdDate,ccrz__OrderStatus__c,ccrz__Account__r.ccrz__E_AccountGroup__c,(select ccrz__Product__r.RLWS_CF_RL_Merch_Division__c from ccrz__E_OrderItems__r ORDER BY CREATEDDATE ASC LIMIT 1) from ccrz__E_Order__c where id =:orderidsset];
     system.debug(' Inside approval-AFTER -->' +orderList);
        Map<Id,String> orderItemsMerchDiv = new Map<Id,String>();
        Set<Id> accountGrpIds= new Set<Id>();
          //[0].ccrz__E_OrderItems__r
       List<String> merchString=new List<String>();
         Map<Id,ccrz__E_Order__c> orderDateMap = new  Map<Id,ccrz__E_Order__c>();
      for(ccrz__E_Order__c cc: orderList)
      {
          system.debug(' cc.ccrz__E_OrderItems__r' +cc.ccrz__E_OrderItems__r +' status '+cc.ccrz__OrderStatus__c);
          if(null!= cc.ccrz__E_OrderItems__r && cc.ccrz__E_OrderItems__r.size()>0){
           orderItemsMerchDiv.put(cc.id, cc.ccrz__E_OrderItems__r[0].ccrz__Product__r.RLWS_CF_RL_Merch_Division__c);
           orderDateMap.put(cc.id,cc);
           accountGrpIds.add(cc.ccrz__Account__r.ccrz__E_AccountGroup__c);
         }           
      }
       // system.debug('#######:' +merchString);
        List<ccrz__E_AccountGroupPriceList__c> Acgplst = [select ccrz__AccountGroup__c,RLWS_CF_Account_Executive__r.id, RLWS_CF_Account_Executive__r.name,RLWS_CF_Merch_Div__c from ccrz__E_AccountGroupPriceList__c where RLWS_CF_Merch_Div__c =:orderItemsMerchDiv.values() and ccrz__AccountGroup__c=:accountGrpIds ];
       // system.debug([select RLWS_CF_Account_Executive__r.name from ccrz__E_AccountGroupPriceList__c where RLWS_CF_Merch_Div__c ='merchString']);
        Map<String,Id> merchDIVAEMaP=  new Map<String,Id>();
       
        System.debug('Merch div:' +Acgplst );
        for(ccrz__E_AccountGroupPriceList__c accGrp : Acgplst){
            merchDIVAEMaP.put(accGrp.RLWS_CF_Merch_Div__c+'!'+accGrp.ccrz__AccountGroup__c, accGrp.RLWS_CF_Account_Executive__r.id);
        }
        System.debug('Account Executive:' +merchDIVAEMaP);
        Map<id,String> orderids=new Map<id,String>();
         Approval.ProcessSubmitRequest req ;
         Approval.ProcessResult result;
        List<Task> taskList = new List<Task>();
        Task taskObj;
        ccrz__E_Order__c ordObj;
        String orderKey;
        for(Id OrderId :orderDateMap.keySet())
        {
            //orderids.put(Ordr.id,Ordr.Name);
             req= new Approval.ProcessSubmitRequest();
            req.setComments('Submiting for Approval');
             req.setObjectId(OrderId);
            ordObj = orderDateMap.get(OrderId);
            orderKey = orderItemsMerchDiv.get(OrderId)+'!'+ordObj.ccrz__Account__r.ccrz__E_AccountGroup__c;
            req.setNextApproverIds(new Id[] {merchDIVAEMaP.get(orderKey)});
            result = Approval.process(req);
        //    ordObj  = new ccrz__E_Order__c(Id=orderId);
          //     orderDateMap.get(orderId).RLWS_CF_Order_Approver__c = merchDIVAEMaP.get(orderItemsMerchDiv.get(orderId));
           taskObj = createTaskForApproval(merchDIVAEMaP.get(orderKey), ordObj.id,ordObj.createdDate);
            taskList.add(taskObj);
        }
        
        if(!taskList.isEmpty()){
            Database.DMLOptions dmlo = new Database.DMLOptions();
            dmlo.EmailHeader.triggerUserEmail = true;
            Database.insert(taskList, dmlo);
        }
    }  
    
    private static Task createTaskForApproval(Id assignId,Id orderId,DateTime orderCreatedDate){
             Integer taskDays = Integer.valueOf(RLWS_Obj_Task_Duration__c.getInstance('Task Duration').RLWS_CF_Task_Due_Date_duration__c);
             Integer reminderHrs = Integer.valueOf(RLWS_Obj_Task_Duration__c.getInstance('Task Duration').RLWS_CF_Task_Reminder_Hours__c);
             Task taskObj = new Task();
             taskObj.OwnerId = assignId;
             taskObj.WhatId = orderId;
             taskObj.IsReminderSet = true;
             taskObj.ReminderDateTime = orderCreatedDate.addHours(reminderHrs); 
             taskObj.Subject = 'Task to Approve Order';
             taskObj.Priority = 'Medium';
             taskObj.Status = 'Not Started';
             taskObj.Type = 'Email'; 
             taskObj.RLWS_CF_From_Order__c = True;
                taskObj.ActivityDate=Date.valueOf(orderCreatedDate.addDays(taskDays));
             taskObj.Description = 'Task for Approve Order';
            // taskObj.RLWS_CF_Task_Type__c ='From Order';
             return taskObj;
        }

}


Note: New to Apex coding 
 Can you please help to cover this in test class
my test class

@isTest
public class RLWS_Cls_OrderApprvlUtility_Test {
 static testMethod void myTest() {
   List<account> accts;
   Account a = new Account(Name='TestAccount');
            accts.add(a);
  //Create an Task  Record
     Task taskObj = new Task();
             taskObj.OwnerId = UserInfo.getUserId();
             taskObj.IsReminderSet = true;
             taskObj.Subject = 'Task to Approve Order';
             taskObj.Priority = 'Medium';
             taskObj.Status = 'Not Started';
             taskObj.Type = 'Email'; 
             taskObj.ActivityDate=Date.today().addDays(7);
             taskObj.Description = 'Task for Approve Order';
        insert taskObj ;
            
    
   List<ccrz__E_Order__c> ordersToCreate=  new List<ccrz__E_Order__c>();
        ccrz__E_Order__c  orderRecord = new ccrz__E_Order__c   ();
            
          /*  orderRecord.ccrz__BuyerLastName__c = 'Test1';  
            orderRecord.ccrz__OrderStatus__c= 'Order Submitted';
            ordersToCreate.add(orderRecord);
            insert ordersToCreate; 
            */
            for(Integer i=6;i<=100;i++)
              {
               orderRecord=new ccrz__E_Order__c(ccrz__BuyerLastName__c='Test1',ccrz__OrderStatus__c='Order Submitted');
               ordersToCreate.add(orderRecord);
              }
              insert ordersToCreate;
            
      test.startTest();
      
  //RLWS_Cls_OrderApprvlUtility Ordersubmit = new RLWS_Cls_OrderApprvlUtility ();
  RLWS_Cls_OrderApprvlUtility.submitForApproval(ordersToCreate);
  test.stopTest();
  }
}
What is the use of Scope Parameter in Batch Apex?
I have a SOQL query Like:  SELECT id,Name from Account   ,
While Querying Records from Account Objects it's taking more time  How to reduce time?
I want to send bulk emails (like 10000) using batch apex .

Is there an limitation while sending mails using Messaging.SingleEmailMessage.
If it is not, then tel me which is the the way to achieve this?
Iam new to customization, I want to know In  which situation we can go with List,set and map.
 
What is the use of SLA in Case.
What is the use of SLA in Case object
public class wrapper_on_account
{
   List<wrapperaccount1> wrapaccount=new List<wrapperaccount1>();
   List<account> selectedaccountlst=new  List<account>();
    public List<wrapperaccount1> getAccounts()
    {
        for(Account a :[select Id, Name, AccountNumber, Phone from Account limit 5])
           wrapaccount.add(new wrapperaccount1(a));{I need Explination for this line}
         //How it works
          return wrapaccount;
         
    }
This is Simple Apex class
When iam creating account associated contact, Opportunity also create. This code Excuted successfully when it was created, after few days i used it with some modification  then it shows the error like 'Variable does not exist: Name'


Public class Acc_Con_Opp_Create
{
 public Account Creation()
 {
  Account acc=new Account();
    acc.Name='Poel';
    acc.NaicsDesc='uagtt';
    insert acc;
    
    Contact cc=new Contact();
    cc.AccountId=acc.Id;
    cc.LastName='John Paul';
    insert cc;
    Opportunity opp=new Opportunity();
    
      opp.AccountId=acc.Id;
      opp.StageName='Stage';
     // Date d=Date.newinstance('2015,11,20');
      opp.CloseDate=system.Today();
      
      opp.Name='Apex created Opportunity';
      insert opp;
      return acc;
      
    }
  }
My scnario was when iam inserting account record automatically associated contact also should  insert:
But iam getting error like ;Variable does not exist: name' but i have field Name on account
trigger account_trigger on Account (after insert,after update)
{
  if(Trigger.isInsert)
  {

    List<Contact> ct = new List <Contact>();

    for(Account acc : trigger.new)
    {

        Contact c = new Contact(LastName=acc.name,AccountId=acc.id,MailingStreet=acc.BillingStree,
                    Phone=acc.Phone);

        ct.add(c);
    }
    insert ct;
  }
}
Iam new to customization, I want to know In  which situation we can go with List,set and map.
 
I am using few custom labels in in my class i have to cover code coverage for that

            /* fetch required properties from custom labels*/\

            Storefront=System.Label.RLWS_CL_EmbTrack_Storefront;
            LOGO=System.Label.RLWS_CF_Logo;
            UniversalLogo=System.Label.RLWS_CF_Universal_Logo;
            UniversalLogoPrice=System.Label.RLWS_CF_Universal_Logo_Price;
            
            currencies = [Select label from RLWS_Obj_Currency__mdt Limit 100];

Can you please tel how to cover this area
 
My scnario was when iam inserting account record automatically associated contact also should  insert:
But iam getting error like ;Variable does not exist: name' but i have field Name on account
trigger account_trigger on Account (after insert,after update)
{
  if(Trigger.isInsert)
  {

    List<Contact> ct = new List <Contact>();

    for(Account acc : trigger.new)
    {

        Contact c = new Contact(LastName=acc.name,AccountId=acc.id,MailingStreet=acc.BillingStree,
                    Phone=acc.Phone);

        ct.add(c);
    }
    insert ct;
  }
}