• {!pramod_nishane}
  • NEWBIE
  • 160 Points
  • Member since 2017
  • Senior Salesforce Developer
  • Sarvaha Systems


  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 41
    Replies
I have created a @RestResource, but the developer I am working with who is making the GET call from an external system is having an issue accessing. What am I missing? Thank you in advance for any help. 

[    
    {        
"errorCode": "FORBIDDEN",        
"message": "You do not have access to the Apex class named:
BlueCloudGetOptyDetail"    
     }
]
I have created a lead, and now it won't let me convert. This is th error message that I am receiving:
Converting A Lead
Global class AnimalLocator {
    Global static String getAnimalNameById(Integer numb){
        String response;
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/'+numb);
        request.setMethod('GET');
        HttpResponse resp = http.send(request);
        if(resp.getStatusCode()==200){
            Map<String,Object> results = (Map<String,Object>) JSON.deserializeUntyped(response.getBody());
            Map<String,Object> animal = (Map<String,Object>)results.get('animal');
            response = (String)animal.get('name');
        }
        return response;
    }
}
I'm getting the error "Method does not exist or incorrect signature : void getBody() from String type "
 
Control Processes with Queueable Apex challenge of Asynchronous Apex module 
I wrote the bellow queueable class
public class AddPrimaryContact implements Queueable{
    public List<Contact> contacts = new List<Contact>();
    List<Account> accs = [Select Id, Name, BillingState from Account];
    public void AddPrimaryContact(List<Account> accs){
    
      for(Account a : accs){
        Contact con = new Contact();
        con.AccountID = a.Id;
        con.LastName = 'Contact of '+a;
        contacts.add(con);
        system.debug('con check'+con);
      }
       insert contacts; 
    }
  public void execute(QueueableContext context){
        for (Contact cont : contacts) {
        cont.MailingState = cont.Account.BillingState;
        }
        update contacts;
    }
}

And then wrote the below test class
@isTest
public class AddPrimaryContactTest {
    
    @testSetup
    static void setup(){
        List<Account> accs = new List<Account>();
        for (Integer j=0; j<2; j++){
            if(j==0){
                for (Integer i=0; i<50; i++){
                    accs.add(new Account( name='TestC Account'+i, BillingState='NY'));
                }
            }
            else{
                 for (Integer i=0; i<50; i++){
                    accs.add(new Account( name='TestD Account'+i, BillingState='CA'));
                }   
                    
             }
            
        }
        insert accs;
    }
    
    static testMethod void testQueueable(){
        List<Account> accts = [Select Id, Name, BillingState from Account where BillingState = 'NY' OR BillingState = 'CA'];
    	AddPrimaryContact addressput = new AddPrimaryContact(accts);
        Test.startTest();
        System.enqueueJob(addressput);
        Test.stopTest();
        
        System.assertEquals(50, [select count() from Contact where MailingState = 'NY']);
        System.assertEquals(50, [select count() from Contact where MailingState = 'CA']);
    }

}

The error I'm getting is "constructor not defined [AddPrimaryContact].(list). And when I run the queueable class in Anonymous execution I don't see SOQL querries running. What could be the issue here ?
I am adding contact in salesforce using REST api, getting error 
[{"message":"Cannot deserialize instance of double from START_OBJECT value { or request may be missing a required field at [line:1, column:501]","errorCode":"JSON_PARSER_ERROR"}]
Please anyone can help.
Hello!
I have been trying to set up a username password Oauth following this link: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_username_password_oauth_flow.htm

I set up a connected app and use its appropraite cliend id and secret. 
I am sending an HTTP post request through a local login .net app I created. I am sending all the appropriate information. However, my app returns a System.Net.WebException error 404. I tried sending a post request through https://openidconnect.herokuapp.com/ . This link says that my URI is unavailable. The URI that I am sending the request to is https://login.salesforce.com/services/oauth2/token. When I send a post request through Postman, it says "invalid client credentials", even though I am sure I am giving the right salesforce login credentials. 

Is this URI not available anymore? What am I doing wrong? 
Hi ,

We are using Wordpress integration with Salesforce to create Leads from web.

Expected behaviour : Leads to be created on submission of FORM1 which is configured in force.com site
Error Scenario : Leads are also generated from FORM2 which is not configured in force.com site but present in Wordpress, Can we stop this creation of Leads from FORM2.

Thanks in advance
I am trying to navigate to the sign up page at https://api.einstein.ai/signup - it brings me to the page to sign up using salesforce.  I am clicking on the sign up using Salesforce.
I click on the Allow access - and get "An error occured while serving your request" email already registered. 

Please help!
I'm trying to use the Username-Password OAuth Authentication Flow to connect to REST

Posting to https://test.salesforce.com/services/oauth2/token
Params
   grant_type = password
   client_id     = from connected app
   client_secret = from connected app
   username = my user name
   password = my password and API token

I'm getting 
   {"error":"invalid_grant","error_description":"authentication failure"}

When I look at my user in salesforce I see this error
    Failed: Login over insecure channel

I'm setting https.protocols = TLSv1,TLSv1.1,TLSv1.2

Any thoughts?
I have created a @RestResource, but the developer I am working with who is making the GET call from an external system is having an issue accessing. What am I missing? Thank you in advance for any help. 

[    
    {        
"errorCode": "FORBIDDEN",        
"message": "You do not have access to the Apex class named:
BlueCloudGetOptyDetail"    
     }
]
Aura App
<aura:application extends="force:slds">
    <c:myContactCmp recordId='0017F00000S7UjN'/>
</aura:application>

Componet 
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" controller="myContactController" access="global" >
    <aura:handler name="init" action="{!c.getContactList}" value="{!this}" />
    <aura:attribute name="contactList" type="List"/>
</aura:component>

Component controller 
({
    getContactList: function(component, event, handler) {
        
        var action = component.get("c.ContactsList");
        //var accId = component.get("v.recordId");
        alert('acc id '+ component.get("v.recordId"));
        /*action.setParams({
            accId : accId
        });*/
                action.setParams({ AccountId : component.get("v.recordId") });

        action.setCallback(this, function(response){
            var state = response.getState();
            if(state == 'SUCCESS'){
                var contactList = response.getReturnValue();
                //alert("From server: " + contactList);
               //console.log("From server: " + contactList);
               component.set("v.contactList", contactList);
            }else{
                alert('alert in getting data');
            }
        });
            $A.enqueueAction(action);       
    }
})

Apex Controller

It's shows null recordId 

public class myContactController {
    
    @AuraEnabled 
    public static List<Contact> ContactsList(Id accountId){
        system.debug('acc id is '+accountId);
        List<Contact> contacts = [SELECT ID,name,AccountId,Phone,Email from Contact where accountId =: accountId];
        return contacts;
    }
}
 
I have read the documentation that every points other similar questions to, but for the life of me I just can't get my head around this.

I have a very simple query
Select Id, Department, Email, FirstName, LastName, Phone From Contact
  Where Id IN (Select OwnerId From Case)
That gives me the error "The selected field 'OwnerId' in the subquery and the left operand field in the where expression in the outer query 'Id' should point to the same object type"

I want to return a list of contacts, but our contacts data is massive.  So I want to only return the contacts that are the owners of cases.   Any suggestions?
 
I have a custom Object SBQQ__Subscription__c. It has some fields that I want to retrieve. This is my controller:

public with sharing class ActiveController_2 {
    
    private ApexPages.StandardController stdController;
    private final Account acct;

    public ActiveController_2(ApexPages.StandardController stdController) {
        this.stdController = stdController;
        this.acct = (Account)stdController.getRecord();
     }

public List<SBQQ__Subscription__c> getSubscriptions() {
        List<SBQQ__Subscription__c> subscriptionResults = [SELECT Name, MasterDeviceName__c, SBQQ__ProductName__c, Location__c, DeviceId__c, SBQQ__ContractNumber__c, Server_Status__c  FROM SBQQ__Subscription__c WHERE DeviceId__c LIKE :acct.AccountNumber];
        return subscriptionResults;
    }
}

I get the following errror: SObject row was retrieved via SOQL without querying the requested field: Account.AccountNumber 

I read through the forum and I saw that there are other people having the same issue and I get that I should mention Account.AccountNumber somewhere in my query, but I cannot understand how.

Also, I went through the WSDL of our organisation and here is what I found on the SBQQ__Subscription__c object:

<complexType name="SBQQ__Subscription__c">
<complexContent>
<extension base="ens:sObject">
<sequence>
<element name="SBQQ__Account__c" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="SBQQ__Account__r" nillable="true" minOccurs="0" type="ens:Account"/>


If you could give me an idea of what is going on in here?
Thank you,
Violeta
I have created a lead, and now it won't let me convert. This is th error message that I am receiving:
Converting A Lead
 I am trying to access additional information about a failed batch job. 

I read the doc at https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_batches_get_info_all.htm
The solution there is to build a URL to form a GET request to return information about a particular job.

Here is the general form of the URL:
https://instance_name—api.salesforce.com/services/async/APIversion/job/jobid/batch

So I then substituted the specifics of my org into this url, and the URL becomes 
https://NA##—api.salesforce.com/services/async/42/job/7071J00008J6XVu/batch (## is instance server)

This should take me to information about the batch. But it doesn't.
It redirects me to 
https://xn--na##api-516c.salesforce.com/services/async/42/job/7071J00008J6XVu/batch

And then I get the following error message in my web browser: 
"This site can’t be reached
xn--naXXapi-516c.salesforce.com’s server IP address could not be found.
Try running Network Diagnostics.
DNS_PROBE_FINISHED_NXDOMAIN"

No information about my batch job is provided.

What is this website?
I formed the URL correctly, so what is going wrong?

SF Support said I needed to access it via API, but the docs said a simple GET request shoudl return info...so what lightweight tool can i use to just get Apex batch info from a jobid?
I am trying to figure out how to prompt a user to create an Opportunity after they've saved an Account that meets our specific criteria. I know there is functionality to do this but I'm not sure how to trigger it this way specifically.  

I've Googled like a mad man and can't seem to find a solid solution so any help would be appreciated. 
Hello I have a problem, the notification via email when changing the owner of a lead does not work. When changing the owner of a lead, I mark the check to send an email and nothing happens. The owner changes but the mail never arrives. It should be noted that this type of email arrives at another type of notifications from the organization, only the problem is in the change of owner manually.

Has someone happened to you?
Is there some kind of configuration that I should review?

I'd appreciate your help.

Regards