• Shravan Sazawal
  • NEWBIE
  • 0 Points
  • Member since 2018
  • CRM Dev

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I have a custom button/action of Action Type lightning component on a custom object that, when clicked, automatically creates a new case record of a certain Record Type, if it isn't linked to an existing case. The requirement is- to avoid automatically creating a case record, and instead give the user an option to manually choose the record type from a pop-up, similar to creating a new case from the Case object itself and then chossing a record type. I'm not too familiar with Lightning dev and would highly appreciate any assistance.

Below is the JS controller code:
({
      CreateCase : function(component, event, helper) {
      
        var caseNumberAdd3 = component.get("c.CasenumberShopp");
       var caseDetails=[];
          var caseid;
        caseNumberAdd3.setParams({
            "shoppingactivityID" :component.get("v.recordId")
        });
           caseNumberAdd3.setCallback(this, function(response){
              
              if(response.getState()==="SUCCESS")
                {
                caseDetails=response.getReturnValue();
                   document.getElementById('loader1').style.display = 'none';
                    if(caseDetails===null){
                        document.getElementById('mainDiv44').style.display = 'block';
                                  
                    }
                    else{
                           $.each(caseDetails, function(key, value){
                   
                    if(key==="Id")
                    {
                        caseid=value;
                        var urlEvent = $A.get("e.force:navigateToURL");
            urlEvent.setParams({
                "url": '/'+ value
                //component.get("v.caseid")
            });
            urlEvent.fire();
                        
                    }
                });
                        
                    }
                         
                }
               });
 $A.enqueueAction(caseNumberAdd3);
            
    },close:function(component, event, helper) {
        document.getElementById("successMsg").style.display = 'none';
    }   
})

I have a custom button/action of Action Type lightning component on a custom object that, when clicked, automatically creates a new case record of a certain Record Type, if it isn't linked to an existing case. The requirement is- to avoid automatically creating a case record, and instead give the user an option to manually choose the record type from a pop-up, similar to creating a new case from the Case object itself and then chossing a record type. I'm not too familiar with Lightning dev and would highly appreciate any assistance.

Below is the JS controller code:
({
      CreateCase : function(component, event, helper) {
      
        var caseNumberAdd3 = component.get("c.CasenumberShopp");
       var caseDetails=[];
          var caseid;
        caseNumberAdd3.setParams({
            "shoppingactivityID" :component.get("v.recordId")
        });
           caseNumberAdd3.setCallback(this, function(response){
              
              if(response.getState()==="SUCCESS")
                {
                caseDetails=response.getReturnValue();
                   document.getElementById('loader1').style.display = 'none';
                    if(caseDetails===null){
                        document.getElementById('mainDiv44').style.display = 'block';
                                  
                    }
                    else{
                           $.each(caseDetails, function(key, value){
                   
                    if(key==="Id")
                    {
                        caseid=value;
                        var urlEvent = $A.get("e.force:navigateToURL");
            urlEvent.setParams({
                "url": '/'+ value
                //component.get("v.caseid")
            });
            urlEvent.fire();
                        
                    }
                });
                        
                    }
                         
                }
               });
 $A.enqueueAction(caseNumberAdd3);
            
    },close:function(component, event, helper) {
        document.getElementById("successMsg").style.display = 'none';
    }   
})

I have a custom button/action of Action Type lightning component on a custom object that, when clicked, automatically creates a new case record of a certain Record Type, if it isn't linked to an existing case. The requirement is- to avoid automatically creating a case record, and instead give the user an option to manually choose the record type from a pop-up, similar to creating a new case from the Case object itself and then chossing a record type. I'm not too familiar with Lightning dev and would highly appreciate any assistance.

Below is the JS controller code:
({
      CreateCase : function(component, event, helper) {
      
        var caseNumberAdd3 = component.get("c.CasenumberShopp");
       var caseDetails=[];
          var caseid;
        caseNumberAdd3.setParams({
            "shoppingactivityID" :component.get("v.recordId")
        });
           caseNumberAdd3.setCallback(this, function(response){
              
              if(response.getState()==="SUCCESS")
                {
                caseDetails=response.getReturnValue();
                   document.getElementById('loader1').style.display = 'none';
                    if(caseDetails===null){
                        document.getElementById('mainDiv44').style.display = 'block';
                                  
                    }
                    else{
                           $.each(caseDetails, function(key, value){
                   
                    if(key==="Id")
                    {
                        caseid=value;
                        var urlEvent = $A.get("e.force:navigateToURL");
            urlEvent.setParams({
                "url": '/'+ value
                //component.get("v.caseid")
            });
            urlEvent.fire();
                        
                    }
                });
                        
                    }
                         
                }
               });
 $A.enqueueAction(caseNumberAdd3);
            
    },close:function(component, event, helper) {
        document.getElementById("successMsg").style.display = 'none';
    }   
})