• Siddhartha Ghosh 17
  • 0 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1

Hi All,

1>I have a button on a standard button  on Account detail page (on click javascript) .... which just passes the account external Id and account Id to an apex class and calls the method.(GETCALLOUT method )
2>Now this GETCALLOUT method makes a callout . the responsebody comes as '{}', which is basically NULLI want to show an error message/alert/popup or anything on the Account detail page.
so basically 

if (response.getBody() == '{}')
            //I need to show the error message that the account is c       unavailable in the source system.

Please help Me. I dont want to perform a DML operation on this condition. I tried to achieve this with apex:messages but there are some restrictions I am facing..

<apex:page controller="CLASS1"
<apex:pageMessages ></apex:pageMessages>

global class CLASS1{
public CLASS1(){
     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'First Error Message added from apex'));
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'Second Error Message added from apex'));
 // I tried with error message but the problem is I am unable to return to the constructor when I am checking the condition 
    public static HttpResponse GETCALLOUT ()
if (response.getBody() == '{}')
            //I need to show the error message that the account is c       unavailable in the source system.


Hey Everyone, 

I am having trouble displaying the Toast message, in a simple Lightning component, Following os the code.

<aura:component implements="flexipage:availableForAllPageTypes" access="global">	

    <aura:attribute name="result" type="String" />
    <div aura:id="input" class="slds-box small" >
        <div aura:id="panelList">
            <header class="slds-m-bottom--small">
                <div class="slds-media slds-media--center slds-m-bottom--small">
                    <div class="slds-media__figure">
                        <lightning:icon iconName="utility:answer" />
                    <div class="slds-media__body">
                        <h2 class="slds-text-heading--small "> Text Analyzer </h2>
                <div class="slds-form-element">
                    <label class="slds-form-element__label slds-assistive-text" for="searchBox">Search</label>
                    <div class="slds-form-element__control">
                        <ui:inputText aura:id="Text2Analyze" class="slds-input" placeholder="Enter any text..." change="{!c.updateSearch}"/>

	updateSearch : function(component, event, helper) {
		var inputText = escape(component.find("Text2Analyze").get("v.value"));
        helper.toastThis(inputText.length, 'Input text Length')

	toastThis : function(message, title) {
        var toastEvent = $A.get("e.force:showToast");
            "title": title || "Error:",
            "message": message,
            "type": "error",
            "mode": "sticky"

demo App
<aura:application extends="force:slds">
    <c:toastComponent />

And This is the Error I am getting, when i tired to run it
Action failed: c:toastcomponent$controller$updateSearch [Cannot read property 'setParams' of undefined]
Failing descriptor: {c:toastcomponent$controller$updateSearch}

Please point out the mistakes i made.