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
Sebastian PageSebastian Page 

Need help on Aura Lightning controller

Hello Expert,

I have created aura lightning component where we  display how many Cases are open.Here we are displaying cases  summery in the three coloumns.
1. Owned by me  2.Owner Name 3. cases

User-added image
I have requirment if there is no ticket assiged to me or my queues than i want aprear one popup measseg on the div.

This is my Controller method. please help me.
action.setCallback(this, function(response) {
      //store state of response
      var state = response.getState();
      if (state === "SUCCESS") {
        //set response value in wrapperList attribute on component.
        component.set("v.lstCases", response.getReturnValue());
          if(response.getReturnValue()>0)
          component.set("v.flag","display:block");
      else
       component.set("v.flag","display:none");

 
Santosh Kumar 348Santosh Kumar 348
You can use ShowToast compoent of Salesforce. It helps you to show a Message like refer below code:
showToast : function(component, event, helper) {
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
        "title": "Success!",
        "message": "The record has been updated successfully."
    });
    toastEvent.fire();
}

 For your case you can place it inside else on line no 11. You can change the title as well as message as per your need.
 
else{
       component.set("v.flag","display:none");
       var toastEvent = $A.get("e.force:showToast");
             toastEvent.setParams({
            "title": "Success!",
            "message": "There are no record assigned to me.."
       });
    toastEvent.fire();
}

Apart from that you can even use alert with whatever message you want to show.
 
else{
      component.set("v.flag","display:none");
      alert('No records assigned to Me');
}


Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful.

Regards,
Santosh Kumar

 
Santosh Kumar 348Santosh Kumar 348
Hi Sebasian,

If the answer has helped you, please mark this answer as best so that others facing the same issue will find this information useful.

Regards,
Santosh