• NArendra Nimmana
  • NEWBIE
  • 75 Points
  • Member since 2017

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
Hi Team,

Q). I have a 3 Objects A,B,C.
Object A is the parent of B, Object B is the parent of C.
How can we get the data from all three objects using single SOQL Query ?


Thanks in Advance..............
Regards
Lakshmi.
 
I'm performing a API call. When running the call in outside a Batchable class the API call is performed withoud problems (for example in Execute Anonymous) . However the exact same call results in a error "INVALID_SESSION_ID" when part of a Batchable Class.

Even when passing the SessionId to the batchable class the error remains. Example code profided below. Does anybody have a solution or idea why the call fails within a Batchable class?

Example code:
public class AutoCreateRelationVisit implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful {
    
    private String sesId;
    
    public AutoCreateRelationVisit(){
        this(UserInfo.getSessionId());
    }
    
    public AutoCreateRelationVisit(String sesId){
        this.sesId = sesId;
    }

    public Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'Select Id FROM MaintenancePlan'; //LIMIT toevoegen
        return Database.getQueryLocator(query);
    }
    
    public void execute (Database.BatchableContext BC, List<MaintenancePlan> scope) {
        String salesforceHost = System.Url.getSalesforceBaseURL().toExternalForm();
        String url = salesforceHost + '/services/data/v40.0/actions/standard/generateWorkOrders';
        
        // Create HTTP request
        HttpRequest request = new HttpRequest();
        request.setEndpoint(url);
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json; charset=UTF-8');
        request.setHeader('Authorization', 'OAuth ' + this.sesId);
        
        //List<MaintenancePlan> mpList=new List<MaintenancePlan>(); use this when updating the MaintenancePlan in next step
        
        //for (MaintenancePlan mp : scope) {
              //Set the body as . JSON object
              string jsonBody = '{"inputs" : [{"recordId" : "1MP260000000006GAA"}]}';
            system.debug(LoggingLevel.Error, 'Json Body' + jsonBody);
            request.setBody(jsonBody);
            Http http = new Http();
            HttpResponse response = http.send(request);
            system.debug(LoggingLevel.Error, response.getBody());
            // Parse the JSON response
            
            if (response.getStatusCode() != 201) {
                System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
            } else {
                System.debug(response.getBody());
            }
       // }
    }
    public void finish(Database.BatchableContext jobId) {}
}
I am pretty new to mobile Development, so i have started with this Trail (https://trailhead.salesforce.com/content/learn/modules/mobile_sdk_hybrid?trail_id=mobile_sdk_intro) and created hybrid_remote app. Everything works great as i could able to access the data trough VF page.
Then I wanted to access the data through Lightning Components.So i have researched and understood that we can't directly use the Lightning Component(LC) inside SFDC mobile sdk, but we can leverage it from Lightning out as mentioned here (https://salesforce.stackexchange.com/questions/112433/is-it-possible-to-use-lightning-component-aura-inside-salesforce-mobile-sdk-hybr).
But the problem here is some how lightning component is not rendering anything on hybrid_remote app. But if i preview the same vf inside sfdc, i could able to see that lightning component has rendered. Please let me know what i am missing here?
Hi,

I have installed CLI as per the guidelines. Then i entered 'sfdx' command in comand prompt as well as in  GitBash but it's not giving the proper response as showing in 'Set Up Salesforce DX' Module. And i am getting the response as below, Could you please help me 
​ 

$ sfdx
panic: Get https://developer.salesforce.com/media/salesforce-cli/sfdx-cli/channels/stable/windows-x64: dial tcp: lookup developer.salesforce.com: getaddrinfow: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.

goroutine 1 [running]:
panic(0x6632a0, 0xc042008780)
        /usr/local/go/src/runtime/panic.go:500 +0x1af
main.must(0x7b92c0, 0xc042008780)
        /home/ubuntu/.go_workspace/src/github.com/heroku/cli/io.go:115 +0x63
main.GetUpdateManifest(0x6a4875, 0x7, 0x6a3c0d, 0x3, 0x7b92c0)
        /home/ubuntu/.go_workspace/src/github.com/heroku/cli/install.go:104 +0x272
main.GetUpdateManifest(0x6a4875, 0x7, 0x6a3c0d, 0x3, 0x0)
        /home/ubuntu/.go_workspace/src/github.com/heroku/cli/install.go:102 +0x2f4
main.Install()
        /home/ubuntu/.go_workspace/src/github.com/heroku/cli/install.go:33 +0x100
main.main()
        /home/ubuntu/.go_workspace/src/github.com/heroku/cli/main.go:18 +0x3a

Thanks & Regards
Narendra Nimmana
Hi Guys,
Can Informatica call a Web Service Implemented in Salesforce Apex? 
If yes could please provide step by step process i don't hav e any idea how to deal with Informativca.
I have written rest api service in Apex.
Thanks,
Narendra Nimmana
My requrement is consider removal of whitespaces both in received data and existing CRM data.

I have written an API, for the recieved data i can remove the white spaces.
for eg; the received string as s1
String s1='abc cb cn';
String s2=s1.deletewhitespace();

With that recived data after removing the spaces, i have to written a soql query by considering removal of white spaces in existing data also.
how can i do that for existing data in soql.?

inside salesforce it was stored like 'abcc bcn'
i want to retrive the id of that particular record with name as above.


Thanks
Narendra.
 
Hi guys,
how can i get the full names of standard/custom profiles?
i have tried in workbench as the following: /services/data/V39.0/tooling/sobjects/Profile/<ID> and can be able to see the full name of profile.
and also i have tried in HTTP rest Call out by setting endpoint, but it is not working.
my requirement is if i pass the ID i need to get the full name of that Profile from Apex??
Hi Team,

Q). I have a 3 Objects A,B,C.
Object A is the parent of B, Object B is the parent of C.
How can we get the data from all three objects using single SOQL Query ?


Thanks in Advance..............
Regards
Lakshmi.
 
I'm performing a API call. When running the call in outside a Batchable class the API call is performed withoud problems (for example in Execute Anonymous) . However the exact same call results in a error "INVALID_SESSION_ID" when part of a Batchable Class.

Even when passing the SessionId to the batchable class the error remains. Example code profided below. Does anybody have a solution or idea why the call fails within a Batchable class?

Example code:
public class AutoCreateRelationVisit implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful {
    
    private String sesId;
    
    public AutoCreateRelationVisit(){
        this(UserInfo.getSessionId());
    }
    
    public AutoCreateRelationVisit(String sesId){
        this.sesId = sesId;
    }

    public Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'Select Id FROM MaintenancePlan'; //LIMIT toevoegen
        return Database.getQueryLocator(query);
    }
    
    public void execute (Database.BatchableContext BC, List<MaintenancePlan> scope) {
        String salesforceHost = System.Url.getSalesforceBaseURL().toExternalForm();
        String url = salesforceHost + '/services/data/v40.0/actions/standard/generateWorkOrders';
        
        // Create HTTP request
        HttpRequest request = new HttpRequest();
        request.setEndpoint(url);
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json; charset=UTF-8');
        request.setHeader('Authorization', 'OAuth ' + this.sesId);
        
        //List<MaintenancePlan> mpList=new List<MaintenancePlan>(); use this when updating the MaintenancePlan in next step
        
        //for (MaintenancePlan mp : scope) {
              //Set the body as . JSON object
              string jsonBody = '{"inputs" : [{"recordId" : "1MP260000000006GAA"}]}';
            system.debug(LoggingLevel.Error, 'Json Body' + jsonBody);
            request.setBody(jsonBody);
            Http http = new Http();
            HttpResponse response = http.send(request);
            system.debug(LoggingLevel.Error, response.getBody());
            // Parse the JSON response
            
            if (response.getStatusCode() != 201) {
                System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
            } else {
                System.debug(response.getBody());
            }
       // }
    }
    public void finish(Database.BatchableContext jobId) {}
}
Hi guys,
how can i get the full names of standard/custom profiles?
i have tried in workbench as the following: /services/data/V39.0/tooling/sobjects/Profile/<ID> and can be able to see the full name of profile.
and also i have tried in HTTP rest Call out by setting endpoint, but it is not working.
my requirement is if i pass the ID i need to get the full name of that Profile from Apex??