function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prema -Prema - 

How to invoke the CloudSense Batch if I abort that batch. Please help me.

Ashish Arun WaghmareAshish Arun Waghmare
Hi Prema ,

Please go throgh the link below , 
https://help.salesforce.com/articleView?id=000171199&type=1

hope it helps.
Prema -Prema -
i know how to invoke the batch but it doesnt invoke the managed package batch when i try to invoke it through namespace it says type is not visible. can u help me with this?
Ashish Arun WaghmareAshish Arun Waghmare
Hi,
Could you let me know how are you trying to invoke . (code please)
Prema -Prema -
I'm trying this one as their class's methods or constructor are not global.
Ashish Arun WaghmareAshish Arun Waghmare
Yup that might be one of the reasons as you need to make the methods as well as the batch global to acess them without any issues .
 
Prema -Prema -
i think i cannot do that right? its may not be possible from my end
Ashish Arun WaghmareAshish Arun Waghmare
You would need to relase a new version of the package that has batch code, after making the changes in the code. So that you can easily invoke the batch going forward.
Prema -Prema -
how to release a new version. Could u please help me
Ashish Arun WaghmareAshish Arun Waghmare
Sure, please check the link below to create a package 
https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/publish_upgrades.htm

Make sure to add the component (batch class in above case) that you have updated before creating the package.

Hope this helps.
Prema -Prema -
not getting still 😔
Prema -Prema -
What should I do next for this batch class could u please guide me
Ashish Arun WaghmareAshish Arun Waghmare
Sure ,

1) Please make the metods and the batch Global.
2) Create a new package with the steps mentioned above.
3) Upgrade this new package and then invoke the batch.
 
Prema -Prema -
i may sound stupid but i m not getting any methods here. its empty.
Ashish Arun WaghmareAshish Arun Waghmare
you will not be able to see the code in org where package is there right now.
you will need to go to the packaging org where its been created and change the code.
Prema -Prema -
So you mean to say if I will create a new package and if i will add this batch class i will be able to see that class's methods and constructors? If this is so then when i had created the package i was not getting that class inside apex class..
Ashish Arun WaghmareAshish Arun Waghmare
You need to update the same code base of package you are currently using .. just update the batch class in it .. by making the methods and the class global .. and create a new version of that .. that should work. 
Prema -Prema -
😖Not getting the class how would i update it and make it global. I am sorry but i am unable to do that.
Ashish Arun WaghmareAshish Arun Waghmare
1) If the class is in the package it must have namespace. 
2) If it has namespace that means it has a packaging org .
3) You need to search for this packaging org and search the class there. 
4) Once done update the batch and its methods by making it global.
Prema -Prema -
thanks for your patience. but unfortunately i have joined this organization recently and they havent informed anything about the packaging org..thank you so much for your quick response. also if you could help me with one more query that would be really great. please let me know if you wont mind.😊
Ashish Arun WaghmareAshish Arun Waghmare
Sure, do let me know your query.
Prema -Prema -
I want to fetch symboltable methods of my apex class inside my apexclass code and I tried to fetch through workbench but I'm not getting anything..could u please help me with that
Ashish Arun WaghmareAshish Arun Waghmare
There is a answer for your query , check the link below from Daniel Ballinger
https://salesforce.stackexchange.com/questions/116165/symbol-table-from-apex-class

I hope this helps.
Prema -Prema -
Still no resolution..
Prema -Prema -
User-added image
Ashish Arun WaghmareAshish Arun Waghmare
Could you please paste the code here if you dont mind.
Prema -Prema -
ToolingAPIWSDL.SforceService toolingService = new ToolingAPIWSDL.SforceService();
toolingService.SessionHeader = new ToolingAPIWSDL.SessionHeader_element();
toolingService.SessionHeader.SessionId = UserInfo.getSessionId();
toolingService.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/T/43.0';

ToolingAPIWSDL.QueryResult result = toolingService.query('select Id, Name from ApexClass WHERE Id = \'01p6F000009v2TfQAI\'');
for(ToolingAPIWSDL.sObject_x acx : result.records) {
    System.debug(acx);
}

 
Prema -Prema -
I am looking to fetch methods section of SymbolTable, which I am not getting. I have multiple ways but no luck..
Ashish Arun WaghmareAshish Arun Waghmare
Did you try with the workbench approach mentioned in below link
https://salesforce.stackexchange.com/questions/116165/symbol-table-from-apex-class

check the image
Prema -Prema -
I had tried this one as well..
Http http = new Http();
String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
String path = '/services/data/v43.0/tooling/query/?q=';
String query = 'Select Id,Name,SymbolTable,Body from ApexClass WHERE Id=\'01p6F000009v2TfQAI\'';
List<sObject> sobjList = Database.query(query);
System.debug('Query'+query);
HttpRequest request = new HttpRequest();
request.setEndpoint(baseUrl+path+query);
request.setMethod('GET');
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
    // Deserialize the JSON string into collections of primitive data types.
    Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
    // Cast the values in the 'animals' key as a list
    //List<Object> animals = (List<Object>) results.get('animals');
    System.debug('Received the following animals:');
    //List<sObject> methods = results[0].symbolTable.methods;
// now you have all methods with their name and parameters
List<Object> Methods = (List<Object>) results.get('Methods');

    for(Object method : methods)
{
    System.debug('Method Id:');
}
}
else
{
String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
System.debug('BaseUrl'+baseUrl);
}
Ashish Arun WaghmareAshish Arun Waghmare
try it through the workbench , it gives you details
Prema -Prema -
I have got the results but my requirement is without going to Workbench I want the data to be displayed inside my apex class..