+ Start a Discussion
veeru_pariveeru_pari 

Dependent class name

Hi,

How can i get the dependent class name of visualforcePage dynamically ..

 

In DEvelop...>Pages..> here we have (show dependencies) .if we click that ShowDependeciesthen it will show the

Apex Class, Trigger and Page References

.

 

Now my ques is how can we get that dependency class,trigger or Pagereference  associated with that page dynamically.And we need  to store that class name in a variable.This we should get for what ever the page we run as there will be many pages.

String variable= 'value'(The Value will be That dependent class name);Here i should store the dependency but it should happen dynamically we should not pass the value manually.

 

Pls reply on this

 

Thanks,

Veeraiah

sandeep@Salesforcesandeep@Salesforce

Click on Page and then you can find class name in fist tag of page. in Cotroller or extension

veeru_pariveeru_pari

Hi sandeep ,

global class JobCount {
String variable= 'Batch_CaseEmail';
    global Integer getBatchesCount() {
    List<AsyncApexJob> lstjobs=[
    SELECT
        Id,
        TotalJobItems
    FROM
        AsyncApexJob
    WHERE CompletedDate = LAST_N_DAYS:365 AND JobType='BatchApex' AND ApexClassId IN (SELECT Id FROM ApexClass WHERE NamespacePrefix =null  AND Name =:variable)];

Integer jobItemsCount = 0;
Integer batchesCount = 0;
for(AsyncApexJob async : lstjobs) {
    jobItemsCount +=async.TotalJobItems;
    batchesCount++;
   
    }
System.debug(variable);

System.debug('############');

   return batchesCount;
    }

 

}

In the above code in place of the the  string value 'Batch_CaseEmail' i am manually passing the value .That class name i am getting from ApexJobs in MOnitoring.So if there are other Bach Classes I have to dynamically get the Name of that classes.Here  avctually iam hard coding i should not do that

 

Please help me on that

 

Thanks

veeraiah