• Gautam_Kasukhela
  • NEWBIE
  • 60 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 23
    Replies
Hey All,
     How can I access a custom URL defined for a community in Apex? 
     I am getting the base URL in Apex by using 
Network.getLoginUrl(communityId)
but this does not give me the custom URL, it gives me the base Url.
e.g my community base url : 
https://abc.force.com/community1
but my Custom URL configured (Setup> Custom URL) for this community is https://www.community1.com

and I want to read the custom URL value in Apex. Any pointers?

Regards,
Gautam.
 
I am encountering an error when I run a simple query on the Contact record. Email is again a Standard Field 
SELECT Id FROM Contact WHERE Email = 'asd@gmail.com'
I get the below error:-
"
[object Object]: SELECT Id FROM Contact WHERE Email = 'asd@gmail.com' ^ ERROR at Row:1:Column:30 field 'Email' can not be filtered in a query call
"

User-added image
Why can't I filter using a Standard (non text area field)??
 
Hello All,
    I am facing a strange issue when decrypting a String that was encoded on the platform. Here is the scenario:-

I have a String named quoteId and I am encrypting the quoteId using AES256 alogorithm and key. Post the encryption, I am encoding it using Base64 encoding. The result is something like the below
Encrypted String:  jVWhnAUT6aoQFEOPmkJp/7QpE3V7uo2LjzC5VUWp31c=
Post encryption, I append the value to a URL query parameter, something like:
https"//xxxxxx?quoteId=jVWhnAUT6aoQFEOPmkJp/7QpE3V7uo2LjzC5VUWp31c=

Now when I decode and decrypt the value after reading the URL Params, it works fine and I am able to see the actual quoteId.

When I encrypt again another encrypted string is generated, something like: ZOWKWKWTSL8QIe7N8B3u80dC+hsmGFQIF0VjVGiB2II=

However, when the decode and decrypt the above, it does not work and I get a error saying "FATAL_ERROR System.SecurityException: last block incomplete in decryption".

What could be the issue? As the encryption, encoding , decoding and decryption logic is the same. Only observation that I have made is whenever there is a '+' in the generated encoded string, an exception is thrown. Is there anything that is probably throwing it off from the URL parameters?

Here is the code snippet
User-added image

I am having trouble completing this badge. I keep getting an error that reads "We can’t find 'reduceErrors' imported into contactList.js."

I double checked the component, it is saved and has the the import statement. My workspace also has the ldsUtils component and even that is saved. This should have been a walk in the park challenge as a similar one is already stated in the trailhead module. Even with similar code as mentioned, I get an error: (https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-and-salesforce-data/handle-server-errors)

//JS FILE
import {
    reduceErrors
} from 'c/ldsUtils';
import {
    LightningElement,
    wire
} from 'lwc';

import FIRST_NAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LAST_NAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import getContacts from '@salesforce/apex/ContactController.getContacts';

const COLUMNS = [{
        label: 'First Name',
        fieldName: FIRST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Last Name',
        fieldName: LAST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Email',
        fieldName: EMAIL_FIELD.fieldApiName,
        type: 'email'
    },
];

export default class ContactList extends LightningElement {

    columns = COLUMNS;
    errors;
    @wire(getContacts)
    contacts;


    get errors() {
        console.log('this.contacts.error: ', this.contacts.error);
        return (this.contacts.error) ? reduceErrors(this.contacts.error) : [];
    }
}

//HTML FILE
<template>
    <lightning-card title="Contact List">


        <template if:true={errors}>
            <p>{errors}</p>
        </template>

        <!--<lightning-datatable key-field="Id" data={contacts.data} columns={columns}>
        </lightning-datatable> -->
    </lightning-card>


</template>

//Controller

public with sharing class ContactController {
    
    @AuraEnabled(cacheable = true)
    public static List<Contact> getContacts(){
        
        //return [SELECT FirstName, LastName, Email FROM Contact];
        throw new AuraHandledException('Forced error');
    }
}
Hello All,
    I have a need to send a platform event with the contents of an object put in a structured JSON format. Includes a few JSON arrays. 
For this, I used JSONGenerator, to structure my code:
//Sample code 

JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartObject();
gen.writeStringField('summary', this.summary);
gen.writeStringField('location', this.location);
gen.writeFieldName('start');
gen.writeStartObject();        
 
......


and I followed the below article to structure the JSON

https://developer.salesforce.com/index.php?title=Getting_Started_with_Apex_JSON

Now, I get the generator as a String and set it to a variable and subsequently assign it to a platform event's Text field.
String ganDetailsJSON = generator.getAsString();

The problem is the receiver of this platform event gets content with all \n. \r & \\ characters :
,\\r\\n \\\“accountNumber\\\” : \\\“88209\\\“,\\r\\n \\\“accountName\\\” : \\\“Harry Potter\\\“,\\r\\n \\\“adviserCode\\\” : \\\“14\\\“,\\r\\n \\\“branchCode\\\” : \\\“99\\\“,\\r\\n \\\“designation\\\”

How can I get rid of the additional characters that are added and make it more readable and parsable JSON format? 
If it was over a webservice, then converting it to a Blob would have helped. But given its a platform event and I need to set it in a tecxt field, is there any other way to work it out?

Regards,
Gautam
 
I have a scenario where in a website needs to make a call to Salesforce and Salesforce in turn needs to call a host of downstream systems with a single SOAP callout.

For the website to connect and send data to Salesforce, a Webservice will be exposed. The downstream system endpoint will be invoked asynchronously from Salesforce. The response from downstream systems can take upto 60 seconds.

I had planned to used Continuation in my SOAP callout from my Webservice, but the below paragraph talks about ignoring concurrent callouts if called from VF page? 

"A typical Salesforce application that benefits from asynchronous callouts contains a Visualforce page with a button. Users click that button to get data from an external Web service. For example, a Visualforce page that gets warranty information for a certain product from a Web service. Thousands of agents in the organization can use this page. Therefore, a hundred of those agents can click the same button to process warranty information for products at the same time. These hundred simultaneous actions exceed the limit of concurrent long-running requests of 10. But by using asynchronous callouts, the requests aren’t subjected to this limit and can be executed."

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_continuation_overview.htm

Can I only use it from a VF page or does the async calls ignore the limits when invoked from anywhere, from a webservice in my case?
Hello All,
    I have an Apex class (SendEmailCommunications) that implements "Database.Batchable<sObject>,Schedulable" and has the 'start', 'execute' & 'finish' methods.
global Database.QueryLocator start(Database.BatchableContext bc)
{
return Database.getQueryLocator( <My Query>);
}

global void execute(Database.BatchableContext bc, List<My_Custom_Object> scope){
        System.debug('Scope Size is: '+scope.size());
 //more logic
}

global void finish(Database.BatchableContext bc)
    {
        System.debug('Sent emails');
    }
I have used the 'Apex Scheduler' in Setup to schedule this class to run at a designated time. As per the logs, the batch job starts and finshes without running any logic. Even the first system.debug statement in my execute method does not get logged.
User-added image
What am I missing here?
 
Hello All,
    I am working with VS Code and I see it is not validating Apex errors. For instance the below code, in VS Code does not show any errors where as it should be showing 2. User-added image

VS Code only shows issues when I miss a semi-colon or a paranthesis. I have Salesforce CLI Integration, Salesforce Extension Pack, Apex extension packs installed. 
Even with these I do not get prompted for errors. I have to copy my code from VS Code and put it in Developer Console to figure out what is wrong. It becomes counter productive.

The same code when I use it in Dev console, shows the required errors
User-added image

What am I missing here in the VS Code Configuration?

 
I am building a custom component to show a list of Cases filtered by a certain criteria. I am using <lightning:dataTable> for this. One of the columns in the list is Record Type and I am unable to display the Name of the Record Type in my list component. It shows up as Id.
 
<lightning:datatable
                             data="{! v.caseData}" 
                              columns="{! v.caseColumns}" 
                              keyField="Id" hideCheckboxColumn="true"/>

//Helper. JS
component.set('v.caseColumns', [
					{label: 'Case Number', fieldName: 'linkName', 
                     type: 'url', 
                     typeAttributes: {label: { fieldName: 'CaseNumber'},target: '_blank'}},
					{label: 'Status', fieldName: 'Status', type: 'text'},
					{label: 'Subject', fieldName: 'Subject', type: 'text'},
                    {label: 'Record Type', fieldName: 'RecordTypeId', type: 'text'},
				]);

//Controller code
listOfCases = [SELECT Id,
                               CaseNumber,
                               Status,
                               RecordType.Name,
                               Subject,
                               OwnerId,
                               CreatedDate
                          FROM Case WHERE xyz...];

In the helper, on the column attributes for Record Type fieldName, I have tried options other than 'RecordTypeId' but that do not show anything in the column. When I run the query in the Console I can see the developer name. What am I missing or doing incorrectly here.

User-added image
Hello All,
    Need help in resolving an issue. I am trying to display the Status picklist field on a lightning component. For this I have written a server side controller to fetch the values and set in the component. 
During the callback in the helper, I keep encountering an error where the reposne is ERROR and the message in the ERROR reads "Unable to read sObject". Below is the code: 

Component Code
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
                access="global"
                controller="FetchValuesFromDatabase">

<aura:handler name="init" value="this" action="{!c.doInit}"/>

<aura:attribute name="case" type="Case" default="{'sObjectType': 'case'}"/>
<aura:attribute name="listOfStatusPicklistValues" type="list" default="[]" description="List of Status Picklist values on Case object"/>

<aura:attribute name="statusFieldAPI" type="string" default="status" description="API name of the Status field whose picklist values we want to fetch"/>
<aura:attribute name="originFieldAPI" type="string" default="origin" description="API name of the Origin field whose picklist values we want to fetch"/>

    <!-- CREATE NEW CASE -->
    <div aria-labelledby="newCaseForm">
        <!-- BOXED AREA -->
        <fieldset class="slds-box slds-theme--default slds-container--small">
        <legend id="newCaseForm" class="slds-text-heading--small 
          slds-p-vertical--medium">
          Add Case
        </legend>
  
        <!-- Create New Case Form : START -->
        <form class="slds-form--stacked">          
            <lightning:select aura:id="newCaseForm" label="Status"
                              name="caseStatus"
                              value="{!v.case.Status}"
                              required="true">
                <aura:iteration items="{!v.listOfStatusPicklistValues}" var="status">
                    <option value="{!status}">{!status} </option>
                </aura:iteration>              
                              

            </lightning:select>                  
            <lightning:select aura:id="newCaseForm" label="Case Origin"
                              name="caseOrigin"
                              value="{!v.case.Origin}"
                              required="true"/>                   
            <lightning:textarea aura:id="newCaseForm" label="Description"
                             name="caseDescription"
                             value="{!v.case.Description}"/>
            
    
        </form>
        <!-- Create New Case Form : END -->
      </fieldset>
      <!-- / BOXED AREA -->
    </div>
    <!-- / CREATE NEW CASE -->
</aura:component>
Controller Code:-
({
    doInit : function(component, event, helper) {
        //get the details of the Object and its fields that we want to retrieve. These have been defined
        // as attributes in the component.
        var picklistFieldAPI = component.get("v.statusFieldAPI");
        var objDetails       = component.get("v.case");

        //call the helper to fetch the values of the picklist from database
        helper.fetchPickListValues(component,objDetails,picklistFieldAPI);
        

    }
})

Helper Code
({
    fetchPickListValues : function(component,objDetails,picklistFieldAPI) {
            //invoke the server-side controller to get the picklist values
            var action = component.get("c.getPicklistValues");
            action.setParams({
                'objDetails' : objDetails,
                'picklistFieldAPI' : picklistFieldAPI
            });
        //set callback action
        action.setCallback(this,function(response){
            debugger;
            if(response.getState() == "SUCCESS"){
                //set the response in the component field
               component.set("v.listOfStatusPicklistValues",response.getReturnValue());
            } else if(response.getState() == "ERROR"){
                var errors = response.getError();
                alert(errors);
            }
        });
			$A.enqueueAction(action);
    }
})

Client-Side Controller Code
public class FetchValuesFromDatabase {
   
    @AuraEnabled
    public static List<String> getPicklistValues(SObject objDetails, string picklistFieldAPI){
        List<String> pickListValues = new List<String>();

        //Check if the object type passed from the component is not null. I yes, return empty list
        Schema.sObjectType objType = objDetails.getSObjectType();
        if(objType == null){
               return pickListValues; 
        }

        //Check if the field API names passed from the component are present on the object.
        //If not, return an empty list
        //Get the fields corresponding to the object in a MAP
        Map<String,Schema.SObjectField> objFieldsMap = objType.getDescribe().fields.getMap();
        if(!objFieldsMap.containsKey(picklistFieldAPI)){
            return pickListValues;
        }
        
        //Get the picklist values of the field
        List<Schema.PicklistEntry> pickListEntries = objFieldsMap.get(picklistFieldAPI).getDescribe().getPicklistValues();
        for(Schema.PicklistEntry ple: pickListEntries){
            pickListValues.add(ple.getValue());
        }
        System.debug('pickListValues: '+pickListValues);
        return pickListValues;
    }
}

what am i missing ?​​​​​​​

 
I am trying to load a lightning card with data from 4 fields of the Account object using "force:recordData" .
I see only one field's data i.e. of the 'Name' field. Following is a code of my component:-
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
	
    <aura:attribute name ="record" type="Object"
                    description="the record object to be displayed"/>
    <aura:attribute name="simpleRecord" type ="Object"
                    description="simplified view record object to be displayed."/>
    <aura:attribute name="recordError" type="String" 
  					description="An error message bound to force:recordData"/>
    <force:recordData 	aura:id="record"
    					layoutType="FULL"
                        recordId="{!v.recordId}"
                        targetError="{!v.recordError}"
                        targetRecord="{!v.record}"
                        targetFields ="{!v.simpleRecord}"
                        mode="VIEW"/>
    <!-- Use the Lightning Data Service to populate the data-->
    <div class="Record Details"> 
        <lightning:card iconName="standard:account" title="{!v.simpleRecord.Name}" >
		            
        <div class="slds-p-horizontal--small">
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Annual Revenue" value="{!v.simpleRecord.AnnualRevenue}" /></p>
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Number of Employees" value="{!v.simpleRecord.NumberOfEmployees}" /></p>
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Billing City" value="{!v.simpleRecord.BillingCity}" /></p>
        </div>
    </lightning:card>
</div>
<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.recordError))}">
    <div class="recordError">
        {!v.recordError}</div>
</aura:if>
                                 
    
    
</aura:component>
What am I missing here that is resulting in a page like the below:-
I am using an Admin profile and I have validated that the fields have data and is accessible for this profile.

User-added image
 
Hello All,
   This is with reference to a trailhead example under (Lightning Component Basics > Handle Actions with Controllers) :
I am trying to invoke a component that invokes a controller. However, when I am clicking on the buttons, nothing happens on the page and neither do I see any logs in the console or error messages in the developer console.

I am wondering if the way I am invoking the component is correct or if I am missing anything else? Screen shots of my code snippets are attached below:-

User-added imageUser-added imageUser-added imageUser-added image
Hello All,
     The SOSL query that I am using to search for a picklist value on a custom object does not return any results, although there are 25 records  in the custom object that contain the value that I am searching for. 

FIND {Airbus} IN ALL FIELDS RETURNING Aircraft__c(Date_of_purchase__c)

I am searching for the 'Airbus' value in all the fields. The Object's 'isSearchable' property is also true. Is there anything that I am missing here?

Regards,
Gautam.
Hello All,
      I am facing a Callout exception which says " Illegal character(s) in message header value: 
{"HEADER": {"APPLICATION-ID": "APP-0000010120", "CUST-ID": "P/001N000000p35DTIAY","REQUEST-TYPE": "REQUEST","REQUEST-TIME":"08092016 16:15:11"},"REQUEST": {"03":"PERSONAL LOAN","04":"421000","07":"DIRECT","11":"QA/UAT","21": {"01":"A B C"},"22":"MALE","27":"02091992","29":[ {"01":"RESIDENCE","03":"543543544","04":"Bihupuria","06":"Assam","05":"435435"}],"30":{"01":"YHGPS7560W"},"31":[{"01": "MOBILE","02":"9664561852"}],"36":"456465465464"}}
"

I have set the header if the request as follows:-
httpReq.setHeader('inputJson_',jsonRequestBody); 
In the 'jsonRequestBody', I have set the content that is show above in curly braces. 

Strange thing is that, if I use the same header value through a REST client (Postman), it works fine. From within Apex, I get the above mentioned issue. Can anyone let me know what is wrong here?

Regards,
Gautam.
Hello,
       I have a custom field on the Account object (no record types) which uses a global picklist. We have built a REST web service and are passing a value for this picklist. Even though we are passing the same value in the web service, we are facing the issue "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Primary Marketplace: bad value for restricted picklist field: Myntra: [Primary_Marketplace__c]"

Screen shot of the global picklist:-
User-added image

And the Primary Market place  custom field's screen shot which uses this global picklist

User-added image

Any inputs as to what might be wrong here??

Regards,
Gautam.

 
Hello All,
       I have a Custom VF page with 2 <apex:pageBlock> sections. One page block section is for data entry and the other is for showing a list of records. I have used reRender on selectOptions to re-render a page block having the list table. But when I change the value in the filter, the page block does not refresh and on the browser console, I get the following error "VFMetadataSender.js:65 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://welcometomyorg-dev-ed.my.salesforce.com') does not match the recipient window's origin ('null')."

However, if I remove the first page block section then the code works absolutely fine. What am I missing when using multiple pageBlocks?????

Below is the code::

<apex:page standardController="Contact" recordSetVar="contacts">
    
    <apex:form >
        <apex:pageBlock title="Create a New Contact" id="pb1">
            <apex:pageBlockSection title="Primary Details">
                <apex:inputField value="{! Contact.FirstName}"/>
                <apex:inputField value="{! Contact.LastName}"/>
                <apex:inputField value="{! Contact.Email}"/>         
            </apex:pageBlockSection>    
               <apex:pageBlockButtons >
                <apex:commandButton title="Create Contact" value="Save" action="{! save}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
        
        <apex:pageBlock title="Contacts List" id="pb">
            <!-- Add a Filter-->
            Filter:
            <apex:selectList value="{! filterId}" size="1">
                <apex:selectOptions value="{! listViewOptions}"></apex:selectOptions>
                <apex:actionSupport event="onchange" reRender="pb"/>
            </apex:selectList>
            <apex:pageBlockTable value="{!contacts}" var="c" id="contactsTable">
                <apex:column value="{!c.FirstName}"/>
                <apex:column value="{!c.LastName}"/>
                <apex:column value="{!c.Email}"/>
            
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>    
</apex:page>
 
Hello All,
   I am currently using VF Email templates to send out a mail (using workflow) on creation of an Account. The email should also have a logo embedded. As per the below article static resources cannot be used and we should upload the logo into the Documents object.

https://help.salesforce.com/apex/HTViewSolution?urlname=Why-images-stored-as-static-resources-cannot-be-seen-in-emails-sent-using-VF-email-templates-1327108316482&language=en_US

In the last line of the above article, it is shown how the image should be referred to in the VF Email template.Some values need to be dynamically populated such as:  https://c.<instance>.content........
How can I get the current instance from the URL without using Apex? (I am not using any controllers). Is there a way to get that value (like cs6,na11, etc.) during rum time? I just need 'cs6' or 'na11' and not the complete URL.

I used a function in a formula field to fetch the value:  LEFT($Api.Partner_Server_URL_320, FIND( '/services', $Api.Partner_Server_URL_320)) but this returns https://cs6.salesforce.com

Regards,
Gautam.

 
Hello All,
    I have a requirement wherein, I need to make a third party call out on click of a custom VF button. While making the call out the external system shows a popup (the external system uses window.open() ) and in here I need to enter the input data.

onclick="window.open('http://thirdparty-callout')"

When I submit the data, a JSON response is returned on the new window. The challenge that I am facing is to parse this data which is on another window. Is there a way by which I can set the JSON response in a responseURL and send it to my VF page to parse it there?

Regards,
Gautam.
Hello All,
Is it possible to generate a PDF document from an apex web service?
My requirement is as follows:
The user wants to download a PDF document in the front end portal (front end being built by a third party). On click of the button, a Web service will be invoked to fetch the data from Salesforce. The response of the web service is a JSON response. The front end does not use a VF page to use renderAs() function.

Is there any way in which I can send this response as a PDF for the portal user to view it as a PDF when he clicks on the buton. The PDF needs to be generated dynamically every time this button is clicked and I do not want to store the PDF data in the attachement object as this may lead to creation of 'n' number of files for a single functionality.
 
Hey All,
     How can I access a custom URL defined for a community in Apex? 
     I am getting the base URL in Apex by using 
Network.getLoginUrl(communityId)
but this does not give me the custom URL, it gives me the base Url.
e.g my community base url : 
https://abc.force.com/community1
but my Custom URL configured (Setup> Custom URL) for this community is https://www.community1.com

and I want to read the custom URL value in Apex. Any pointers?

Regards,
Gautam.
 
I am encountering an error when I run a simple query on the Contact record. Email is again a Standard Field 
SELECT Id FROM Contact WHERE Email = 'asd@gmail.com'
I get the below error:-
"
[object Object]: SELECT Id FROM Contact WHERE Email = 'asd@gmail.com' ^ ERROR at Row:1:Column:30 field 'Email' can not be filtered in a query call
"

User-added image
Why can't I filter using a Standard (non text area field)??
 

I am having trouble completing this badge. I keep getting an error that reads "We can’t find 'reduceErrors' imported into contactList.js."

I double checked the component, it is saved and has the the import statement. My workspace also has the ldsUtils component and even that is saved. This should have been a walk in the park challenge as a similar one is already stated in the trailhead module. Even with similar code as mentioned, I get an error: (https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-and-salesforce-data/handle-server-errors)

//JS FILE
import {
    reduceErrors
} from 'c/ldsUtils';
import {
    LightningElement,
    wire
} from 'lwc';

import FIRST_NAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LAST_NAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import getContacts from '@salesforce/apex/ContactController.getContacts';

const COLUMNS = [{
        label: 'First Name',
        fieldName: FIRST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Last Name',
        fieldName: LAST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Email',
        fieldName: EMAIL_FIELD.fieldApiName,
        type: 'email'
    },
];

export default class ContactList extends LightningElement {

    columns = COLUMNS;
    errors;
    @wire(getContacts)
    contacts;


    get errors() {
        console.log('this.contacts.error: ', this.contacts.error);
        return (this.contacts.error) ? reduceErrors(this.contacts.error) : [];
    }
}

//HTML FILE
<template>
    <lightning-card title="Contact List">


        <template if:true={errors}>
            <p>{errors}</p>
        </template>

        <!--<lightning-datatable key-field="Id" data={contacts.data} columns={columns}>
        </lightning-datatable> -->
    </lightning-card>


</template>

//Controller

public with sharing class ContactController {
    
    @AuraEnabled(cacheable = true)
    public static List<Contact> getContacts(){
        
        //return [SELECT FirstName, LastName, Email FROM Contact];
        throw new AuraHandledException('Forced error');
    }
}
Hello All,
    I have an Apex class (SendEmailCommunications) that implements "Database.Batchable<sObject>,Schedulable" and has the 'start', 'execute' & 'finish' methods.
global Database.QueryLocator start(Database.BatchableContext bc)
{
return Database.getQueryLocator( <My Query>);
}

global void execute(Database.BatchableContext bc, List<My_Custom_Object> scope){
        System.debug('Scope Size is: '+scope.size());
 //more logic
}

global void finish(Database.BatchableContext bc)
    {
        System.debug('Sent emails');
    }
I have used the 'Apex Scheduler' in Setup to schedule this class to run at a designated time. As per the logs, the batch job starts and finshes without running any logic. Even the first system.debug statement in my execute method does not get logged.
User-added image
What am I missing here?
 
I am building a custom component to show a list of Cases filtered by a certain criteria. I am using <lightning:dataTable> for this. One of the columns in the list is Record Type and I am unable to display the Name of the Record Type in my list component. It shows up as Id.
 
<lightning:datatable
                             data="{! v.caseData}" 
                              columns="{! v.caseColumns}" 
                              keyField="Id" hideCheckboxColumn="true"/>

//Helper. JS
component.set('v.caseColumns', [
					{label: 'Case Number', fieldName: 'linkName', 
                     type: 'url', 
                     typeAttributes: {label: { fieldName: 'CaseNumber'},target: '_blank'}},
					{label: 'Status', fieldName: 'Status', type: 'text'},
					{label: 'Subject', fieldName: 'Subject', type: 'text'},
                    {label: 'Record Type', fieldName: 'RecordTypeId', type: 'text'},
				]);

//Controller code
listOfCases = [SELECT Id,
                               CaseNumber,
                               Status,
                               RecordType.Name,
                               Subject,
                               OwnerId,
                               CreatedDate
                          FROM Case WHERE xyz...];

In the helper, on the column attributes for Record Type fieldName, I have tried options other than 'RecordTypeId' but that do not show anything in the column. When I run the query in the Console I can see the developer name. What am I missing or doing incorrectly here.

User-added image
Hello All,
    Need help in resolving an issue. I am trying to display the Status picklist field on a lightning component. For this I have written a server side controller to fetch the values and set in the component. 
During the callback in the helper, I keep encountering an error where the reposne is ERROR and the message in the ERROR reads "Unable to read sObject". Below is the code: 

Component Code
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
                access="global"
                controller="FetchValuesFromDatabase">

<aura:handler name="init" value="this" action="{!c.doInit}"/>

<aura:attribute name="case" type="Case" default="{'sObjectType': 'case'}"/>
<aura:attribute name="listOfStatusPicklistValues" type="list" default="[]" description="List of Status Picklist values on Case object"/>

<aura:attribute name="statusFieldAPI" type="string" default="status" description="API name of the Status field whose picklist values we want to fetch"/>
<aura:attribute name="originFieldAPI" type="string" default="origin" description="API name of the Origin field whose picklist values we want to fetch"/>

    <!-- CREATE NEW CASE -->
    <div aria-labelledby="newCaseForm">
        <!-- BOXED AREA -->
        <fieldset class="slds-box slds-theme--default slds-container--small">
        <legend id="newCaseForm" class="slds-text-heading--small 
          slds-p-vertical--medium">
          Add Case
        </legend>
  
        <!-- Create New Case Form : START -->
        <form class="slds-form--stacked">          
            <lightning:select aura:id="newCaseForm" label="Status"
                              name="caseStatus"
                              value="{!v.case.Status}"
                              required="true">
                <aura:iteration items="{!v.listOfStatusPicklistValues}" var="status">
                    <option value="{!status}">{!status} </option>
                </aura:iteration>              
                              

            </lightning:select>                  
            <lightning:select aura:id="newCaseForm" label="Case Origin"
                              name="caseOrigin"
                              value="{!v.case.Origin}"
                              required="true"/>                   
            <lightning:textarea aura:id="newCaseForm" label="Description"
                             name="caseDescription"
                             value="{!v.case.Description}"/>
            
    
        </form>
        <!-- Create New Case Form : END -->
      </fieldset>
      <!-- / BOXED AREA -->
    </div>
    <!-- / CREATE NEW CASE -->
</aura:component>
Controller Code:-
({
    doInit : function(component, event, helper) {
        //get the details of the Object and its fields that we want to retrieve. These have been defined
        // as attributes in the component.
        var picklistFieldAPI = component.get("v.statusFieldAPI");
        var objDetails       = component.get("v.case");

        //call the helper to fetch the values of the picklist from database
        helper.fetchPickListValues(component,objDetails,picklistFieldAPI);
        

    }
})

Helper Code
({
    fetchPickListValues : function(component,objDetails,picklistFieldAPI) {
            //invoke the server-side controller to get the picklist values
            var action = component.get("c.getPicklistValues");
            action.setParams({
                'objDetails' : objDetails,
                'picklistFieldAPI' : picklistFieldAPI
            });
        //set callback action
        action.setCallback(this,function(response){
            debugger;
            if(response.getState() == "SUCCESS"){
                //set the response in the component field
               component.set("v.listOfStatusPicklistValues",response.getReturnValue());
            } else if(response.getState() == "ERROR"){
                var errors = response.getError();
                alert(errors);
            }
        });
			$A.enqueueAction(action);
    }
})

Client-Side Controller Code
public class FetchValuesFromDatabase {
   
    @AuraEnabled
    public static List<String> getPicklistValues(SObject objDetails, string picklistFieldAPI){
        List<String> pickListValues = new List<String>();

        //Check if the object type passed from the component is not null. I yes, return empty list
        Schema.sObjectType objType = objDetails.getSObjectType();
        if(objType == null){
               return pickListValues; 
        }

        //Check if the field API names passed from the component are present on the object.
        //If not, return an empty list
        //Get the fields corresponding to the object in a MAP
        Map<String,Schema.SObjectField> objFieldsMap = objType.getDescribe().fields.getMap();
        if(!objFieldsMap.containsKey(picklistFieldAPI)){
            return pickListValues;
        }
        
        //Get the picklist values of the field
        List<Schema.PicklistEntry> pickListEntries = objFieldsMap.get(picklistFieldAPI).getDescribe().getPicklistValues();
        for(Schema.PicklistEntry ple: pickListEntries){
            pickListValues.add(ple.getValue());
        }
        System.debug('pickListValues: '+pickListValues);
        return pickListValues;
    }
}

what am i missing ?​​​​​​​

 
I am trying to load a lightning card with data from 4 fields of the Account object using "force:recordData" .
I see only one field's data i.e. of the 'Name' field. Following is a code of my component:-
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
	
    <aura:attribute name ="record" type="Object"
                    description="the record object to be displayed"/>
    <aura:attribute name="simpleRecord" type ="Object"
                    description="simplified view record object to be displayed."/>
    <aura:attribute name="recordError" type="String" 
  					description="An error message bound to force:recordData"/>
    <force:recordData 	aura:id="record"
    					layoutType="FULL"
                        recordId="{!v.recordId}"
                        targetError="{!v.recordError}"
                        targetRecord="{!v.record}"
                        targetFields ="{!v.simpleRecord}"
                        mode="VIEW"/>
    <!-- Use the Lightning Data Service to populate the data-->
    <div class="Record Details"> 
        <lightning:card iconName="standard:account" title="{!v.simpleRecord.Name}" >
		            
        <div class="slds-p-horizontal--small">
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Annual Revenue" value="{!v.simpleRecord.AnnualRevenue}" /></p>
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Number of Employees" value="{!v.simpleRecord.NumberOfEmployees}" /></p>
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Billing City" value="{!v.simpleRecord.BillingCity}" /></p>
        </div>
    </lightning:card>
</div>
<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.recordError))}">
    <div class="recordError">
        {!v.recordError}</div>
</aura:if>
                                 
    
    
</aura:component>
What am I missing here that is resulting in a page like the below:-
I am using an Admin profile and I have validated that the fields have data and is accessible for this profile.

User-added image
 
Hello All,
   This is with reference to a trailhead example under (Lightning Component Basics > Handle Actions with Controllers) :
I am trying to invoke a component that invokes a controller. However, when I am clicking on the buttons, nothing happens on the page and neither do I see any logs in the console or error messages in the developer console.

I am wondering if the way I am invoking the component is correct or if I am missing anything else? Screen shots of my code snippets are attached below:-

User-added imageUser-added imageUser-added imageUser-added image
Hello All,
     The SOSL query that I am using to search for a picklist value on a custom object does not return any results, although there are 25 records  in the custom object that contain the value that I am searching for. 

FIND {Airbus} IN ALL FIELDS RETURNING Aircraft__c(Date_of_purchase__c)

I am searching for the 'Airbus' value in all the fields. The Object's 'isSearchable' property is also true. Is there anything that I am missing here?

Regards,
Gautam.
Hello All,
      I am facing a Callout exception which says " Illegal character(s) in message header value: 
{"HEADER": {"APPLICATION-ID": "APP-0000010120", "CUST-ID": "P/001N000000p35DTIAY","REQUEST-TYPE": "REQUEST","REQUEST-TIME":"08092016 16:15:11"},"REQUEST": {"03":"PERSONAL LOAN","04":"421000","07":"DIRECT","11":"QA/UAT","21": {"01":"A B C"},"22":"MALE","27":"02091992","29":[ {"01":"RESIDENCE","03":"543543544","04":"Bihupuria","06":"Assam","05":"435435"}],"30":{"01":"YHGPS7560W"},"31":[{"01": "MOBILE","02":"9664561852"}],"36":"456465465464"}}
"

I have set the header if the request as follows:-
httpReq.setHeader('inputJson_',jsonRequestBody); 
In the 'jsonRequestBody', I have set the content that is show above in curly braces. 

Strange thing is that, if I use the same header value through a REST client (Postman), it works fine. From within Apex, I get the above mentioned issue. Can anyone let me know what is wrong here?

Regards,
Gautam.
Hello,
       I have a custom field on the Account object (no record types) which uses a global picklist. We have built a REST web service and are passing a value for this picklist. Even though we are passing the same value in the web service, we are facing the issue "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Primary Marketplace: bad value for restricted picklist field: Myntra: [Primary_Marketplace__c]"

Screen shot of the global picklist:-
User-added image

And the Primary Market place  custom field's screen shot which uses this global picklist

User-added image

Any inputs as to what might be wrong here??

Regards,
Gautam.

 
The Issue In requesting SOAP API.Please resolve it

soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>sf:UNSUPPORTED_CLIENT</faultcode>
         <faultstring>UNSUPPORTED_CLIENT: TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.</faultstring>
         <detail>
            <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
               <sf:exceptionCode>UNSUPPORTED_CLIENT</sf:exceptionCode>
               <sf:exceptionMessage>TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.</sf:exceptionMessage>
            </sf:UnexpectedErrorFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>
Hi, I am having trouble with the "Attributes and Expressions" module from trailhead.

Here is the challenge:
Create a Lightning Component to display a single item for your packing list.
  • Create a component called campingListItem that displays the name (ui:outputText) and the three custom fields using the appropriate output components.
  • Add an attribute named 'item' for type Camping_Item__c.
I created an component named campingListItem and this is the code:
<aura:component >
    <aura:attribute name="item" type="<my_domain>__Camping_Item__c"/>
    
    <ui:outputText value="{!v.item.Name}"/>
    <ui:outputCheckbox value="{!v.item.<my_domain>__Packed__c}"/>
    <ui:outputCurrency  value="{!v.item.<my_domain>__Price__c}"/>
    <ui:outputNumber value="{!v.item.<my_domain>__Quantity__c}"/>
</aura:component>

The error that I am getting is: "Challenge Not yet complete... here's what's wrong: 
The packingListItem Lightning Component's attribute tag doesn't exist or its attributes are not set correctly."

With this, I tried to create another component, with the name "packingListItem", but It didn't work.

Can anyone help me?

Thanks,