• rahul soni 20
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 7
    Replies

Error:::   <apex:page> is required and must be the outermost tag in the markup at line 1 column 1

 

<apex:page standardController="Opportunity">
    
    <apex:outputField value="{!Opportunity.Name}"/><br/>
    <apex:outputField value="{!Opportunity.Amount}"/><br/>
    <apex:outputField value="{!Opportunity.CloseDate}"/><br/>
    <apex:outputField value="{!Opportunity.Account.Name}"/>
    
</apex:page>

getting error :   Invalid type: WarehouseSyncSchedule

@istest
public class WarehouseSyncScheduleTest
{
     @isTest
    static void WarehousescheduleTest(){
        String scheduleTime = '00 00 01 * * ?';
        Test.startTest();
        Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock());
        String jobID=System.schedule('Warehouse Time To Schedule to Test', scheduleTime, new WarehouseSyncSchedule());
        Test.stopTest();
        CronTrigger a=[SELECT Id FROM CronTrigger where NextFireTime > today];
        System.assertEquals(jobID, a.Id,'Schedule ');
    }
}
   
// here i am counting error :: Invalid type: WarehouseSyncSchedule

@isTest
public class WarehouseSyncScheduleTest{
    @isTest
    static void testWarehouseSyncSchd(){
        String sch = '0 0 0 * * ? 2020';
        Test.startTest();
            // Set mock callout class
            Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock());
            String jobId = System.schedule('ScheduledWarehouseTest', sch, new WarehouseSyncSchedule());
            
            CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobId];
            
            System.assertEquals(sch, ct.CronExpression);
        Test.stopTest();
    }
}
can we intergate google meet/ g suit  with education cloud?
Please design the solution accordingly : 

custom objects : university, college, student 
WE NEED TO POPUP THE COLLAGE TOPPER IN COLLAGE TAB ACCORDING TO STUDENT HIGHEST MARKS

UNIVERSITY LOOKUP COLLAGE
COLLAGE    LOOKUP STUDENT



 
// to get the duplicate recored (bulkified)

 trigger duplicateUpdateOnApexObj on APEX_TEST__c (before insert) {   
    Set<APEX_TEST__c> stuList = new Set<APEX_TEST__c>();               // set to store the single record of 1 kind
    for(APEX_TEST__c s : trigger.new){                                  
        stuList.add(s);                                                // add value to set
        
    }    
    
    List<APEX_TEST__c> stuUpdateList = [SELECT ID, Name__c from APEX_TEST__c WHERE Name__c in : stuList];
    
    Map<String, APEX_TEST__c> mapStudent = new Map<String, APEX_TEST__c>();
    for(APEX_TEST__c a : stuUpdateList){
        mapStudent.put(a.Name__c, a);
    }
    for(APEX_TEST__c f : trigger.new){
        if(mapStudent.get(f.APEX_TEST__c) != null){
            f.addError('D U P L I CA TE ');
        }
    }
        
}

17 Variable does not exist: APEX_TEST__c
10 Invalid bind expression type of APEX_TEST__c for column of type String
trigger mobileUpdate on APEX_TEST__c (before insert, after insert, after update, before update) {
    List<APEX_TEST__c> mobile = new List<APEX_TEST__c>();
    
    for(APEX_TEST__c m : mobile){
        m.mobile__c = '9413836278';
    }
    insert mobile;
}

I want to update mobile filed for all record. any help??
trigger checkSecretInformation on Case (after insert, before update) {
    String childCaseSubject = 'case may contaions secrect info';
    
            // 1. create a collection that having each secrect keyword
		     List<String> secrectKeywords = new List<String>();
                secrectKeywords.add('credit card');
                secrectKeywords.add('credit card');
                secrectKeywords.add('social security');
                secrectKeywords.add('ssn');
                secrectKeywords.add('passport');
                secrectKeywords.add('bodyweight');
    
     // 2. check if our case contaions any secrect keyword 
      List<Case>	caseWithSecrectInfo = new List<Case>();
    for(Case myCase :Trigger.new) {
        if(myCase.Subject != childCaseSubject){
        for (String keyword : secrectKeywords) {
             if(myCase.Description != null && myCase.Description.containsIgnoreCase(keyword)){
                caseWithSecrectInfo.add(myCase);
                 System.debug('Case' + myCase.Id + 'include secrect keyword ' + keyword);
                 break;
             }
        }
        }
     
    }
  
  // 3. create a child case, if secrect keyword is there
  List<Case> casestoCreate = new List<Case>();
    for(Case caseWithSecrectInfo : caseWithSecrectInfo ) {
        Case childCase           = new Case();
        childCase.Subject        = childCaseSubject;
        childCase.ParentId       = caseWithSecrectInfo.Id;
        childCase.IsEscalated    = true;
        childCase.Priority       = 'High';
        childCase.Description    = 'Atleast one of the secrect keyword found' + secrectKeywords;
        casestoCreate.add(childCase);
 
    }
    insert childCase;
    }

Secret keyword listed, child case need to create if any word includes,,

How can I display that particular keyword in the child's case?

New to developing.. explanation will be helpful..
 
Hi expert,

 My requirment is to send the analytic dashboard to external layer like: webpage.
what steps do i need to follow. In which form i need to give data to web develpoer sp that they can config to that webpage.
getting error :   Invalid type: WarehouseSyncSchedule

@istest
public class WarehouseSyncScheduleTest
{
     @isTest
    static void WarehousescheduleTest(){
        String scheduleTime = '00 00 01 * * ?';
        Test.startTest();
        Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock());
        String jobID=System.schedule('Warehouse Time To Schedule to Test', scheduleTime, new WarehouseSyncSchedule());
        Test.stopTest();
        CronTrigger a=[SELECT Id FROM CronTrigger where NextFireTime > today];
        System.assertEquals(jobID, a.Id,'Schedule ');
    }
}
   
// here i am counting error :: Invalid type: WarehouseSyncSchedule

@isTest
public class WarehouseSyncScheduleTest{
    @isTest
    static void testWarehouseSyncSchd(){
        String sch = '0 0 0 * * ? 2020';
        Test.startTest();
            // Set mock callout class
            Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock());
            String jobId = System.schedule('ScheduledWarehouseTest', sch, new WarehouseSyncSchedule());
            
            CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobId];
            
            System.assertEquals(sch, ct.CronExpression);
        Test.stopTest();
    }
}
Please design the solution accordingly : 

custom objects : university, college, student 
WE NEED TO POPUP THE COLLAGE TOPPER IN COLLAGE TAB ACCORDING TO STUDENT HIGHEST MARKS

UNIVERSITY LOOKUP COLLAGE
COLLAGE    LOOKUP STUDENT



 
trigger mobileUpdate on APEX_TEST__c (before insert, after insert, after update, before update) {
    List<APEX_TEST__c> mobile = new List<APEX_TEST__c>();
    
    for(APEX_TEST__c m : mobile){
        m.mobile__c = '9413836278';
    }
    insert mobile;
}

I want to update mobile filed for all record. any help??
Hello everyone I could use some help on the using future Methods trailhead. Please keep in mind I am not an Apex coder at all but I am trying to learn as much as I can.

Here is the Task

Create an Apex class with a method using the @future annotation that accepts a List of Account IDs and updates a custom field on the Account object with the number of contacts associated to the Account. Write unit tests that achieve 100% code coverage for the class.
Create a field on the Account object called 'Number_of_Contacts__c' of type Number. This field will hold the total number of Contacts for the Account.
Create an Apex class called 'AccountProcessor' that contains a 'countContacts' method that accepts a List of Account IDs. This method must use the @future annotation.
For each Account ID passed to the method, count the number of Contact records associated to it and update the 'Number_of_Contacts__c' field with this value.
Create an Apex test class called 'AccountProcessorTest'.
The unit tests must cover all lines of code included in the AccountProcessor class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

I have written an Apex class and a Test class but I think I am doing them both Wrong: because when I try to check the challenge i Get this error

Challenge Not yet complete... here's what's wrong: 
The 'AccountProcessorTest' test class doesn't appear to be calling the 'AccountProcessor.countContacts' method between Test.startTest() and Test.stopTest().


When I run the Test class I get this error :

System.QueryException: List has no rows for assignment to SObject

Here is the CLASS:
 
public class AccountProcessor {
     @future

  public static void someFutureMethod(List<id> scope) {

   Account[] updates = new Account[] {};
        for (AggregateResult ar : [
                select AccountId a, count(Id) c
                from Contact
                where AccountId in :scope
                group by AccountId
                ]) {
            updates.add(new Account(
                    Id = (Id) ar.get('a'),
                    Number_of_Contacts__c = (Decimal) ar.get('c')
                    ));
        }
        update updates;
    }

}

Here is the Test Class:
 
@IsTest
public class AccountProcessorTest {
  public static testmethod void TestAccountProcessorTest() {
 
Test.startTest();
     Account a = new Account();
        a.Name = 'Test Account';
        Insert a;
      
      Contact cont = New Contact();
      
      cont.FirstName ='Bob';
      cont.LastName ='Masters';
      cont.AccountId = a.Id;
      Insert cont;

    Test.stopTest() ;
     Contact ACC = [select AccountId from Contact where id = :a.id LIMIT 1];

 
        System.assert(Cont.AccountId != null);
        System.assertequals(cont.id, ACC.AccountId);

  }}

I have used alot or diffrent google searches to get me this far. But I have not Idea if Im even remotly close to the right answer or not.


 
Hi expert,

I am new in web service region. can any one help me to give an example apex class how to send data from salesforce to external system ?

Thanks