You need to sign in to do that
Don't have an account?
veeru_pari
Getting class name
Hi ,
Can i know how to get the classname from the show depandency view in apex pages
In develop>>page>>if we click VFpage we will get the showdependencies so the page is dependent on the Apexclass
Now using code i want to get that ApexClass related to the page and store it in a variable.so how can i achieve this
Thanks,
Veeraiah
You can't do that in Apex - the page and class information forms part of the metadata api which isn't exposed via Apex.
However, doesn't your page already know the class through the controller declaration? Why would you want to store that elsewhere?
Hi bob,
Actually i want store that class name in a variable as shown in the code.
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;
}
so i need the clas name...
Thanks,
Veeraiah
That sounds like you just want to look up the jobs associated with a particular name rather than anything intrinsic to the page. I'd put that in a custom setting.
HI Bob,
I nstead its intrinsic i want to find out if a page has batch job running .This i want to do for all pages.so i need code to perform this instead of checking for each and every page.
Thanks,
Veeraiah
The controller will have to expose a property then - you can't introspect pages and classes using Apex I'm afraid.