• Amitesh Patara
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
Even after removing the necessary fields it says make sure you have removed the correct fields from the layout. I think some kind of bug is causing this issue and its really annoying. Before it said partner account layout could not be found and now this. Attached are the screenshots of the error message and my layout page. Kindly fix this or if thers a way around it let me know.

User-added image

User-added image

Rating
Region
Zone
Has Support Plan
Support Plan Expiration Date 

These are the fields which were asked to remove in the challenge for this layout.
Hi,
I am stuck in Step 2 (Automate Accounts) . I am getting below error message.
Challenge Not yet complete... here's what's wrong:
Please check the configuration of the custom fields on the Account object. The formulas, rollup summaries, etc. did not produce the expected outcome.

I have Created Custom Fields as below
Number of deals, Number_of_deals__c --> Roll-Up Summary (COUNT Opportunity)     
Number of won deals, Number_of_won_deals__c --> Roll-Up Summary (COUNT Opportunity) with filter criteria of Closed Won
Amount of won deals, Amount_of_Won_Deals__c --> Roll-Up Summary (SUM Opportunity) with filter criteria of Closed Won
Last won deal date, Last_won_deal_date__c --> Roll-Up Summary (MAX Opportunity)
Deal win percent, Deal_win_percent__c - Formula --> IF ( Number_of_deals__c > 0, (Number_of_deals__c / Number_of_won_deals__c ), 0))
Call for Service, Call_for_Service__c - Formula --> IF(OR(TODAY() - 730 > Last_won_deal_date__c , TODAY() + 730 < Last_won_deal_date__c ), 'Yes','No')

Also my Validation Rules are configured as :
For Account Name Edit Validation - Created 2 Validation Rules
ISCHANGED( Name ) && ISPICKVAL(Type, "Customer - Channel")
ISCHANGED( Name ) && ISPICKVAL(Type, "Customer - Direct" )

For Billing State/Province Validation Rule is
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY", BillingState))

For Billing Country Validation Rule is
BillingCountry <> "US" && BillingCountry <> "USA" && BillingCountry <> "United States" &&  NOT( ISBLANK(BillingCountry ) )

Same Validation rule are set for Shipping State/Province and Shipping Country (with correct field name).

Can anyone help me with this????
Hi,

I'm not able to complete #2 Automate Accounts. It give me the following error.
"Challenge Not yet complete... here's what's wrong:
Please check the configuration of the custom fields on the Account object. The formulas, rollup summaries, etc. did not produce the expected outcome."


Can anyone tell me what went wrong? Thanks.

My Custom Fields configuration are as following:
  • Number of deals (Roll-Up Summary field): Count Opportunity. No filter criteria
  • Number of won deals (Roll-Up Summary field): Count Opportunity with filter criteria as "Stage equals Closed Won"
  • Last won deal date (Roll-Up Summary field): MAX(Opportunity: Close Date) with filter criteria as "Stage equals Closed Won"
  • Deal win % (Formula field): Number_of_won_deals__c / Number_of_deals__c
  • Total amount of won deals (Roll-Up Summary field): SUM(Opportunity: Amount) with filter criteria as "Stage equals Closed Won"
  • Call for Service (Formula field): IF( DATE( YEAR(Last_won_deal_date__c)+2 , MONTH(Last_won_deal_date__c) , DAY(Last_won_deal_date__c) ) <= TODAY(), 'YES', 'NO')
Hi, 

I am trying to complete Apex specialist Superbadge- Step 1. Below is my helper class and trigger.
 
public class MaintenanceRequestHelper {
    
    public void updateWorkOrders(Set<Id> ids ){
       List<Case> NewMaintenanceRequest = new List<Case> ();
       List<Work_Part__c> wpl = new List<Work_Part__c> ();
        
       List<Case> CaseList = new List<Case> ();
       CaseList = [Select Id, Type, Vehicle__c, Equipment__c, (SELECT Id, Equipment__r.Maintenance_Cycle__c 
                                                            FROM Work_Parts__r ORDER BY Equipment__r.Maintenance_Cycle__c ASC)
                                                            from Case Where Id IN : ids
                                                           AND isClosed = true AND (Type = 'Repair' OR Type = 'Routine Maintenance')];
                                               
            For (Case c : CaseList)
            {

              Integer cycleDays = c.Work_Parts__r[0].Equipment__r.Maintenance_Cycle__c.intValue(); 
             
                 Case mr= new Case();
                 mr.Vehicle__c       = c.Vehicle__c;
                 mr.Equipment__c     = c.Equipment__c;
                 mr.Type             = 'Routine Maintenance';
                 mr.Subject          = 'Routine Maintenance follow up';
                 mr.Date_Reported__c = date.Today();
                 mr.Date_Due__c      = date.Today()+ cycleDays;
                
               
               NewMaintenanceRequest.add(mr); 
            }
            
              insert NewMaintenanceRequest;
          
       }
               
                 
        // update workorders

 
Hi Team...  
         am trying to develop a "Online Movie Ticket Booking App". Do you guys have any previous developed app for this type of application. If so, can you share it with me, I can use as reference or give me suggestions.  

​Thanks,Lucky
Hiya folks, can someone help me figure out what the heck is wrong? My code passes all my unit tests, and eveyrthing works as it should in the org...

The error:
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: Update failed. First exception on row 0 with id 500360000034o9zAAA; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, MaintenanceRequest: execution of AfterUpdate caused by: System.NullPointerException: Argument cannot be null. Class.MaintenanceRequestHelper.updateWorkOrders: line 33, column 1 Trigger.MaintenanceRequest: line 12, column 1: []


The code:
public class MaintenanceRequestHelper {
    
    public static void updateWorkOrders(List<Case> maintenanceRequests){

        Set<Case> targetRequests = new Set<Case>();
        for (Case mr : maintenanceRequests)
            if (('Repair' == mr.Type || 'Routine Maintenance' == mr.Type) && 'Closed' == mr.Status)
                targetRequests.add(mr);

        List<AggregateResult> results = [
            SELECT Maintenance_Request__c, MIN(Equipment__r.Maintenance_Cycle__c)
            FROM Work_Part__c
            WHERE Maintenance_Request__c IN :targetRequests
            GROUP BY Maintenance_Request__c
        ];

        Map<Id, Integer> requestToMinCycle = new Map<Id, Integer>();
        for (AggregateResult ar : results)
            requestToMinCycle.put(
                (Id)ar.get('Maintenance_Request__c'),
                ((Double)ar.get('expr0')).intValue()
            );

        List<Case> workOrders = new List<Case>();
        for (Case t : targetRequests)
            if (('Repair' == t.Type || 'Routine Maintenance' == t.Type) && 'Closed' == t.Status)
                workOrders.add(new Case(
                    Vehicle__c=t.Vehicle__c,
                    Type='Routine Maintenance',
                    Subject=t.Subject,
                    Status='New',
                    Date_Reported__c=Date.today(),
                    Date_Due__c=Date.today().addDays(requestToMinCycle.get(t.Id))
                ));
        
        if (!workOrders.isEmpty())
            insert workOrders;
    } 
}
The error appears to be targeting my line where assign the new Date_Due__c, implying the Case is not in my requestToMinCycle map. But I mean... everything works! And the value is populated correctly in both my unit and practical tests! So what the heck?!

Any thoughts?

Thanks very much!
 
Hi guys, I'm almost finished with the test to get tge Apex Specialist SuperBadge, I attempt to validate the "Test automation logic" but I can't really see what is my error or why is not passing. This is the message I get:

"Challenge Not yet complete... here's what's wrong: 
The 'MaintenanceRequest' trigger does not appear to be handling bulk operations correctly. For the positive use case of inserting and updating more than 200 records, it did not produce the expected outcome."

and here is my code:

Trigger:
 
trigger MaintenanceRequest on Case (after update) {
	
	//List<Case> casesToEvaluate = new List<Case>();
	Map<Id, Case> casesToEvaluate = new Map<Id, Case>();

	if(Trigger.isAfter && Trigger.isUpdate){
		for(Case maintenance:Trigger.new){
			if((maintenance.Type.contains('Repair') || maintenance.Type.contains('Routine Maintenance')) && maintenance.Status == 'Closed'){
				casesToEvaluate.put(maintenance.Id,maintenance);
			}
		}		
	}
	MaintenanceRequestHelper.updateWorkOrders(casesToEvaluate);
}

Here's the class:
 
public class MaintenanceRequestHelper {

	public static void updateWorkOrders(Map<Id, Case>  cases){
		List<Case> maintenance_routineList = new List<Case>();

		List<Product2> listProduct = [select Id, Maintenance_Cycle__c from Product2];  
		Map<Id,decimal> mapProduct = new Map<Id, decimal>();
		
		for (Product2 p : listProduct) {
			if (p != null) {
				if(p.Maintenance_Cycle__c != null){
					mapProduct.put(p.Id, p.Maintenance_Cycle__c);
				}				
			}
		}

		System.debug('### product: '+mapProduct);

		for(Case maintenance:cases.values()){
			Case maintenanceNew = new Case();
			maintenanceNew.Subject = 'Routine Maintenance';
			System.debug('### Second: '+mapProduct.get(maintenance.Equipment__c));
			if (mapProduct.get(maintenance.Equipment__c) != null) {
				
				 maintenanceNew.Date_Due__c = Date.today().addDays(Integer.valueOf(mapProduct.get(maintenance.Equipment__c)));
				     
            }
			maintenanceNew.Vehicle__c = maintenance.Vehicle__c;
			maintenanceNew.Product__c = maintenance.Product__c;
			maintenanceNew.ContactId  = maintenance.ContactId;
			maintenanceNew.AccountId  = maintenance.AccountId;
			maintenanceNew.AssetId    = maintenance.AssetId;
			maintenanceNew.Type 	  = 'Routine Maintenance';
			maintenanceNew.Status 	  = 'New';
			maintenanceNew.Equipment__c = maintenance.Equipment__c;
			maintenanceNew.Date_Reported__c = Date.today();


			maintenance_routineList.add(maintenanceNew);
		}

		insert maintenance_routineList;
	}
}

And my testmethod:
 
@isTest
private class MaintenanceRequestHelperTest {
	
	@isTest static void test_method_one() {

		List<Case> caseList = new List<Case>();
		List<Case> secondList = new List<Case>();

		Account acc = new Account();
		acc.Name = 'test';
		insert acc;

		Contact contact = new Contact();
		contact.FirstName = 'test';
		contact.LastName = 'last';
		contact.Email = 'test@test.com';
		contact.AccountId = acc.Id;
		insert contact;

		Vehicle__c vehicle = new Vehicle__c();
		vehicle.Name = 'car';
		insert vehicle;

		Product2 product = new Product2();
		product.Name = 'test';
		product.isActive = true;
		product.Maintenance_Cycle__c = 2;
		product.Replacement_Part__c = true;
		insert product;

		for(Integer i=1;i<=1000;i++){
			Case maintenanceNew             = new Case();
			maintenanceNew.Subject          = 'Other';
			maintenanceNew.Vehicle__c       = vehicle.Id;
			maintenanceNew.Product__c       = product.Id;
			maintenanceNew.ContactId        = contact.Id;
			maintenanceNew.AccountId        = acc.Id;
			maintenanceNew.Type             = 'Other';
			maintenanceNew.Status           = 'New';
			maintenanceNew.Equipment__c     = product.Id;
			maintenanceNew.Date_Reported__c = Date.today();
			maintenanceNew.Date_Due__c      = Date.today();

			caseList.add(maintenanceNew);	
		}

		insert caseList;
		System.assertEquals(1000,caseList.size());

		for(Case cas:caseList){
			//update information
			cas.Type = 'Repair';
			cas.Status = 'Closed';
			secondList.add(cas);
		}

		update secondList;
		List<Case> createdCases = [Select Id from Case where Type = 'Routine Maintenance'];
		System.assertEquals(1000,createdCases.size());
	
	}	
}

Can someone help me to undestand what I'm missing?.  Thanks in advance.

Edgar,
 
ODagneaux99
Hi,

I have this problem on the superbadge - Apex Specialist - challenge 1

Challenge Not yet complete... here's what's wrong: 
Inserting a new Maintenance Request of type 'Routine Maintenance' and then closing it did not create of a new Maintenance Request based upon the original record correctly. The challenge is expecting to find the closed Maintenance Request plus an 'New' Maintenance Request of type 'Routine Maintenance' with the same Vehicle as the closed one.


I've checked several times. All seems right. I have a 'New' Maintenance Request of type 'Routine Maintenance' with the same Vehicle as the closed one.

Here is the closed maintenance request

User-added image

and here is the new maintenance request that has been automatically created

User-added image

Please help me :-). I want to have my superbadge :-)
 

Hi all,

 

I created a trigger that will update the Event owner to the owner of the Lead whenever the Lead owner is changed.  We have a process where we assign a Lead to a queue with a scheduled appointment(Event) already assigned to an admin.  

 

The trigger will only fire if the Lead owner does not equal a "Queue" owner.

 

I am getting an error when:

 

 

  1. There is more than one Event on the Lead
  2. If there are no Events on the Lead
trigger ownerupdate on Lead (after Update) {

List<Event> aplist = new List<Event>();

for(Lead t : Trigger.new){

if (
(t.LeadSource == 'Telemarketing')  
&&
(t.Owner_Convert_Queue__c == NULL)
)

{Event ap = [Select WhoId, Whatid, OwnerId from Event where WhoId = :t.Id];

            
ap.OwnerId = t.OwnerId;

aplist.add( ap );

}}
update aplist;
}

 

Any help would be appreciated.

 

Thanks,

Alex