• akash_dev__c
  • NEWBIE
  • 80 Points
  • Member since 2018
  • Salesforce Developer


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 20
    Replies
Hello,

I want to display a custom button on a record. I use lighting. 
once the button  is clicked,  I want to display a popup which has a pickiest with value 1, 2. And a button tick, when the pick list is clicked  I want to send the value to apres class.

How can I implemeimplement case in lightning. 

Thanks for suggestions 
Greetings everyone,
     I recently created a process to automatically create service contract records whenever an oportunity is set to 'closed won', and then to notify the tech lead in charge of the project using an email alert. The email is supposed to contain a link to the created record. The email template itself contains a working link for service contracts, but when the tech lead gets the email alert, the link doesnt appear.

     Does anyone have any advice for getting this to work? I would greatly appreciate any insight on the matter.

Regards, 
Connor
Hi Everyone,

I am trying to complete my superbadge of  Einstein Analytics and Discovery Insights Specialist and facing the error : 

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: LVROSXAB

Please help me to solve it.

User-added image

Any help would be highly appreciated.

Regards,
Akash Garg
Hi all,

I am trying to use lightning:fileUpload in my lightning page and I am getting an error saying can't upload while uploading the file..

Component:

<aura:component implements="force:lightningQuickAction,flexipage:availableForAllPageTypes" access = "global">
    
    <aura:attribute name="displayedSection" type="string" default=""/>
    <aura:attribute name="accept" type="List" default="['.jpg', '.jpeg']"/>
    <aura:attribute name="multiple" type="Boolean" default="true"/>
    <aura:attribute name="disabled" type="Boolean" default="false"/>
    <br></br>
    <br></br>
    <br></br>
    <aura:attribute name="options" type="List" default="[
                                                        {'label': 'Cash Claim', 'value': '0127F000000EPoKQAW'},
                                                        {'label': 'Cell Phone Claim', 'value': '0127F000000EPoUQAW'},
                                                        {'label': 'Broadband Claim', 'value': '0127F000000EPoPQAW'},
                                                        {'label': 'Petrol &amp; Driver Claim Phone', 'value': '0127F000000EPoZQAW'}]"/>
    <aura:attribute name="value" type="String"/>
    <div class="slds-box">
        <div aura:id="firstsection" class="{!if(v.displayedSection == '','slds-show','slds-hide')}">
            <lightning:radioGroup name="radioGroup"
                                  label="Claim Record Type"
                                  options="{! v.options }"
                                  value="{! v.value }"
                                  type="radio"
                                  onclick= "{!c.displaySection2}"/>
        </div>
    <br><br>
        </br></br>    
    
    <div aura:id="secondsection" class="{!if(v.displayedSection == 'secondsection','slds-show','slds-hide')}">
        <lightning:recordEditForm aura:id="recordViewForm" recordTypeId="{!v.value}" objectApiName="Claim_Request__c"> 
            <lightning:messages />  
            
            
            <lightning:inputField fieldName="Claim_Amount__c" required = "true" />
            <lightning:inputField fieldName="Claim_Month__c" required = "true" />
            <lightning:inputField fieldName="Claim_Year__c" required = "true"/>
            <lightning:inputField fieldName="Description__c" />
            <lightning:inputField fieldName="Phone_Number__c" default = "In case of cell phone claim"/>
            <lightning:inputField fieldName="Broadband_Number__c"  default = "In case of broadband claim" />
            
            <lightning:button aura:id="submit" type="submit" label="Create Claim" class="slds-m-top_medium" onclick = "{!c.showSuccessToast}" /> 
            
        </lightning:recordEditForm>        

        <lightning:fileUpload label="Add attachment" multiple="{!v.multiple}" 
                          accept="{!v.accept}" recordId="{!v.value}" 
                          onuploadfinished="{!c.handleUploadFinished}" />
        
        
    </div>
</div>
</aura:component>

controller: 

({
    displaySection1 : function(component, event, helper) {
        component.set("v.displayedSection","firstsection");
        var action = component.find("v.value");
    },
 
    displaySection2 : function(component, event, helper) {
        var action = component.get("v.value");
        //action.setParams({
        //    "ID": component.get("v.recordId")          
        //})
        //component.find("firstsection");
        ///component.set("v.displayedSection","section1");
        component.set("v.displayedSection","secondsection");
        console.log("Claim Request has been submitted");
        
    },
    
    handleUploadFinished : function(component, event, helper) {
        var uploadedFiles = event.getParam("files");
        var documentId = uploadedFiles[0].documentId;
        var fileName = uploadedFiles[0].name;
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "File "+fileName+" Uploaded successfully."
        });
        toastEvent.fire();
        
        $A.get('e.lightning:openFiles').fire({
            recordIds: [documentId]
        });
        
    },
    
    showSuccessToast : function(component,event,helper)
    {
        var newClaimRequest = {'objectApiName' : 'claim_request__c', 
                               'claim_amount__c' : '', 
                               'claim_month__c' : '',
                               'claim_year__c' : '',
                               'claim_description__c' : '',
                               'Phone_Number__c' : '',
                               'Broadband_Number__c' : ''
                              };
        //resetting the Values in the form
        component.set("v.recordViewForm",newClaimRequest); 
        
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "claim request has been successfully submitted"
        });
        toastEvent.fire();
    }  
});

please help, tried a lot and not able to identify what's missing.
Hi, I am getting the above error when I am executing a lioghtning component.

Below is my code, please help!

Lightning Component :

<aura:component controller="ClaimRequest"    implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" 
                access="global" >
    
    <!-- Include Static Resource-->
    <ltng:require styles = "/resource/SLDS/styles/salesforce-lightning-design-system.min.css"/>
    <!--scripts="/resource/bootstrap/js/jquery.js,/resource/bootstrap/js/bootstrap.min.js"/>-->
    
    <!-- Define Attribue-->
    <aura:attribute name="claimrequest" type="Claim_Request__c" default="{'sobjectType': 'Claim_Request__c',
                                                                         'Claim_Amount__c' : '',
                                                                         'Claim_Date__c' : '' ,
                                                                         'Claim_Month__c' : '',
                                                                         'Claim_Year__c' : '' ',
                                                                         'Claim_Description__c' : '',
                                                                         'Claim__Type__c' : '',
                                                                         'Open_Date__c' : ''
                                                                         }"/>
     <div class="container-fluid">
        <h3>Please Enter The Claim Information</h3>
        <div class="form-group">
            <label>Claim Amount</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Amount__c}"/>
        </div>
        <div class="form-group">
            <label>Claim Date</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Date__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Month</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Month__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Year</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Year__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Description</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Description__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Type</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Type__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Open Date</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Open_Date__c}"/>
        </div>
         
         <div class="col-md-4 text-center">
        <ui:button class="btn btn-default" press="{!c.create}">Create</ui:button>
  </div>
    </div>
</aura:component>

JS controller
({
    create : function(component, event, helper) {
        console.log('Create record');
        
        //getting the claim information
        var claimrequest = component.get("v.claimrequest");
        
        //Validation
        if($A.util.isEmpty(claimrequest.Claim_Amount__c) || $A.util.isUndefined(claimrequest.Claim_Amount__c)){
            alert('Claim Amount is Required');
            return;
        }            
        if($A.util.isEmpty(claimrequest.Claim_Date__c) || $A.util.isUndefined(claimrequest.Claim_Date__c)){
            alert('Claim Date is Rqquired');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Month__c) || $A.util.isUndefined(claimrequest.Claim_Month__c)){
            alert('Claim Month is Required');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Year__c) || $A.util.isUndefined(claimrequest.Claim_Year__c)){
            alert('Claim Year is Required');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Type__c) || $A.util.isUndefined(claimrequest.Claim_Type__c))
        {
            alert('Claim Type is required');
        }
        if($A.util.isEmpty(claimrequest.Open_Date__c) || $A.util.isUndefined(claimrequest.Open_Date__c))
        {
            alert('Claim Open Date is required');
        }
        
        //Calling the Apex Function
        var action = component.get("c.createRecord");
        
        //Setting the Apex Parameter
        action.setParams({
            claimrequest : claimrequest
        });
        
        //Setting the Callback
        action.setCallback(this,function(a){
            //get the response state
            var state = a.getState();
            
            //check if result is successfull
            if(state == "SUCCESS"){
                //Reset Form
                var newClaimRequest = {'sobjectType': 'Claim_Request__c',
                                    'Claim_Amount__c' : '',
                                    'Claim_Date__c' : '' ,
                                    'Claim_Month__c' : '',
                                    'Claim_Year__c' : '',
                                    'Claim_Description__c' : '',
                                    'Claim__Type__c' : '',
                                    'Open_Date__c' : ''                                     
                                   };
                //resetting the Values in the form
                component.set("v.claimrequest",newClaimRequest);
                alert('Record is Created Successfully');
            } else if(state == "ERROR"){
                alert('Error in calling server side action');
            }
        });
        
        //adds the server-side action to the queue        
        $A.enqueueAction(action);

    }
})

Controller Class

public with sharing class ClaimRequest {
    /**
   * Create a new claim request Record
   *
   * @param Claim_Request__c claimrequest  claimrequest record to be inserted
   * 
   */
    @AuraEnabled
    public static void createRecord (Claim_Request__c claimrequest){
        
        try{
            System.debug('ClaimRequest::createRecord::claimrequest'+claimrequest);
            
            if(claimrequest != null){
                insert claimrequest;
            }
            
        } catch (Exception ex){
            
        }
        
    } 

}

Thanks in Advance!
Hello,

I am trying to create a visualforce page listing all the etitlements based on the userId. I have created a global class and using its function in a different class and when I am trying to show the data on the vf page it is showing me the error.

Here is my code: 
VF page

<apex:page standardcontroller="Claim_Request__c" extensions="EntitlementData" >
        <html>
            <head>
           
            </head>
            <body>
                <apex:pageBlock title="Entitlement details of the employee">
                    <apex:pageBlockSection columns="1">
                        <apex:form >
                            
                                <table>
                                    <tr>
                                        <th>Entitlement Type</th>
                                        <th>Entitlement Amount</th>
                                         <th>Entitlement Applicability</th>
                                    </tr>
                                    <apex:repeat value="{!entitlements}" var="entitle">
                                           <apex:repeat value="{!entitlements[entitle]}" var="map">

                                    <tr>
                                        <td><apex:outputfield value="{!map.Entitlement_Type__c}" /></td>
                                        <td><apex:outputfield value="{!map.Entitlement_Amount__c}"/></td>
                                        <td><apex:outputfield value="{!map.Applicability__c}"/></td>
                                    </tr>
                                        </apex:repeat>
                                    </apex:repeat>
                                </table>    
                                <br/>
                            
                        </apex:form>
                    </apex:pageBlockSection>
                </apex:pageBlock>
            </body>
        </html>
</apex:page>

Controller

public class EntitlementData 
{   
    Map<Id, Object > entitlements {get;set;}
    
    public user usr;
    public EntitlementData(ApexPages.StandardController controller )
    {
        
        List <Id> lst = new list<Id>();
           TESTQurty bg1 = new TESTQurty();
    
        //query to take out the current user department information
        user usr = [select id from user where id =: Userinfo.getUserId()]; 
           lst.add(usr.Id);
        entitlements = bg1.getEmployeeEntitlements(lst);
    }
}

Global Class

public class TESTQurty {
    // Global Enums 
    public enum APPLICABILITY {MONTHLY, ANNUALLY}
    public enum CATEGORY {ORGANIZATIONAL, DEPARTMENTAL}
   
    // Global Constants
    public final String ENTL_DPT_REC_TYPE = 'Department Entitlement';
    public final String ENTL_GBL_REC_TYPE = 'Global Entitlement';
   
    public User usr;
  
    // Global data structures
    // To Store Entitlement Information
    public class Entitlements {
        Decimal Amount {get;set;}
        String Type {get;set;} // Entitlement Types e.g. Phone, Broadband etc.
        APPLICABILITY Applicability {get;set;}
        CATEGORY Category {get;set;}
        
        public Entitlements(Decimal Amt, String EType, APPLICABILITY apl, CATEGORY cat)
        {
            Amount = Amt; 
            Type=EType; 
            Applicability=apl; 
            Category=cat;
            
        }
    }
    
    // To Store Claimed Data
    public  class ClaimedInfo {
        Decimal Amount {get;set;}
        String Type {get;set;} // Entitlement Types e.g. Phone, Broadband etc.
        String Month {get;set;} 
        String Year {get;set;}
        
        public ClaimedInfo(Decimal amt, String cType, String mon, string yr)
        {
            amount = amt;
            Type = cType;
            month = mon;
            year= yr;
        }
    }
    
    // Utility method to get the list of all entitlements 
    // applicable to the given list of employee ids
    public Map<Id, List<Entitlements>> getEmployeeEntitlements(List<Id> EmployeeIds){
        
        
        // Local variables
        Map<Id, List<Entitlements>> mapEntilementsByEmpIds = new Map<Id, List<Entitlements>>();
        Map<Id, List<Entitlements>> mapEntilementsByDepts = new Map<Id, List<Entitlements>>();
        List<Entitlement__c> lstEntitlementsByEmp = new List<Entitlement__c>();
        List<Entitlements> lsEntitlementGlobal = new List<Entitlements>();
        
        // Get list of departments for the given list of employees
        //Set<Id> lstDepartments = new Set<Id>();
        Map<Id,Id> mapDeptByEmp = new Map<Id, Id>();
        // Query Employee and get Department details
        for(Employee__c emps: [SELECT Id,Department_Number__c from Employee__c where Id =: EmployeeIds]){
            // Check if exist in the set if not then add
            if(!mapDeptByEmp.containsKey(emps.id))
                mapDeptByEmp.put(emps.id, emps.Department_Number__c);    
            
        }// End of for
        System.debug('Emp By Dept : ' + mapDeptByEmp);
        
        
                
        // Query Entitlements Object to get list of all entitlements 
        for(Entitlement__c entl : [SELECT Entitlement_Type__c,
                                        Entitlement_Amount__c,
                                        Applicability__c,
                                        RecordType.Name,
                                        Department_Number__c
                                    FROM Entitlement__c 
                                    WHERE 
                                        (Department_Number__c = : mapDeptByEmp.values()
                                    AND RecordType.Name =: ENTL_DPT_REC_TYPE) 
                                     OR RecordType.Name =: ENTL_GBL_REC_TYPE]){
            
            // Check if this is the record is global or departmental
            if(entl.RecordType.Name == ENTL_GBL_REC_TYPE){
                lsEntitlementGlobal.add(new Entitlements (entl.Entitlement_Amount__c,
                                                          entl.Entitlement_Type__c,                                                    
                                                         (entl.Applicability__c=='Monthly')?APPLICABILITY.MONTHLY:APPLICABILITY.ANNUALLY,
                                                         CATEGORY.ORGANIZATIONAL
                                                         ));
            } else if(entl.RecordTYpe.Name == ENTL_DPT_REC_TYPE )    {        
            
                    // Check if employee exists in the map
                    if (!mapEntilementsByDepts.containsKey(entl.Department_Number__c) ){
                        
                        List<Entitlements> lstEntitlement = new List<Entitlements>();
                        
                        lstEntitlement.add(new Entitlements(entl.Entitlement_Amount__c,
                                                          entl.Entitlement_Type__c,                                                    
                                                         (entl.Applicability__c=='Monthly')?APPLICABILITY.MONTHLY:APPLICABILITY.ANNUALLY,
                                                         CATEGORY.DEPARTMENTAL));
                        
                        mapEntilementsByDepts.put(entl.Department_Number__c, lstEntitlement);
                        
                    } else {
                        

                        mapEntilementsByDepts.get(entl.Department_Number__c).add(new Entitlements(entl.Entitlement_Amount__c,
                                                                                                  entl.Entitlement_Type__c,                                                    
                                                                                                  (entl.Applicability__c=='Monthly')?APPLICABILITY.MONTHLY:APPLICABILITY.ANNUALLY,
                                                                                                  CATEGORY.DEPARTMENTAL));
                        
                    } /// End of Check if employee exists in the map
            
            
            } // End of else if
        
        } // End of for
        system.debug(lsEntitlementGlobal);
        system.debug(mapEntilementsByDepts);
        
        
        
        // Populate the final out put map based on employee
        for(Id empId:EmployeeIds ){
            
            
            // Add departmental entitlements for the employee
            mapEntilementsByEmpIds.put(empId, mapEntilementsByDepts.get(mapDeptByEmp.get(empId)));        
                        
            // Add global list applicable for the employee
            mapEntilementsByEmpIds.get(empId).addAll(lsEntitlementGlobal);
        }// End of for        
        
        return mapEntilementsByEmpIds;
        
    } // End of getEmployeeEntitlements

Thanks in Advance
Hey,

I have used lighning datatable to show my custom object fields on thr browser but I am not getting any data on my screen.

Below is the code I have written:

This is my main component:

<aura:component implements="force:appHostable" controller="EntitlementListControllerx">
    
    <!-- attributes -->
    <aura:attribute name="data" type="Object"/>
    <aura:attribute name="columns" type="List"/>
    
    <!-- handlers-->
    <aura:handler name="init" value="{!c.doInit }" action="{!this }"/>


    <!-- the container element determine the height of the datatable -->
    <div style="height: 300px">
        <lightning:layout horizontalAlign="space">
            <lightning:layoutItem size="12">
                <lightning:datatable
                                    keyField="id"
                                    data="{! v.data }"
                                    columns="{! v.columns }"
                                    hideCheckboxColumn="true"/>
                </lightning:layoutItem>
        </lightning:layout>
    </div>
</aura:component>

Controller:

({
    doInit: function (cmp, event, helper) {
        cmp.set('v.columns', [
            {label: 'Entitlement Name', fieldName: 'Name', type: 'text'},
            {label: 'Entitlement Number', fieldName: 'Entitlement_Name__c', type: 'text'},
            {label: 'Entitlement Amount', fieldName: 'Entitlement_Amount__c', typeAttributes: { currencyCode: 'USD'}},
            {label: 'Entitlement Type', fieldName: 'Entitlement_Type__c', type: 'text'},
        ]);

        helper.getEntitlement(cmp,helper);
    }
})

Helper:\

({
    getEntitlement : function(cmp) {
        helper.callServer(cmp,"c.getEntitlementList",
                                   function(response){
                                       for(var i=0; i>response.length; i++){
                                           var row = response[i];
                                           row.Owner = row.Contact__r.Name;
                                       }
                                        cmp.set("v.data", response);//set data in the page variable
        });
    }
})

Controller to fetch the data:

public with sharing class EntitlementListControllerx     
{
     @AuraEnabled//Annotation to use method in lightning component
    
    public static List<Entitlement__c> getEntitlementList() 
    {//Fetch data
        return [SELECT Id,Name,Entitlement_Name__c, Entitlement_Amount__c, Entitlement_Type__c, CreatedDate FROM Entitlement__c];
    }    
}

Please help!
Hi All,

I am new to salesforce and I want to create a component based on claim request object which will fill the fields in cliam request form based on an obejct name global entitlement and I want to fill the fields based on the employee name and department name which are also in the claim request page.

Thanks
Hello,

I want to display a custom button on a record. I use lighting. 
once the button  is clicked,  I want to display a popup which has a pickiest with value 1, 2. And a button tick, when the pick list is clicked  I want to send the value to apres class.

How can I implemeimplement case in lightning. 

Thanks for suggestions 
Topic Name: 
Extend Your Reporting Strategy with the AppExchange


Challenge is:

You’ve been asked to create a new Lead trending dashboard. Rather than creating the dashboard from scratch, install a CRM adoption dashboard package from AppExchange in your Trailhead Playground and update one of the dashboard components as specified below. (Note: While it's a best practice to clone a dashboard before you modify it, for this example, you can go ahead and edit the dashboard directly.)
Get your username and password for your Trailhead Playground using the instructions in this article
Install Salesforce Adoption Dashboards from AppExchange into your Trailhead Playground
Refresh the 3 - Sales & Marketing Adoption dashboard in the Salesforce Adoption Dashboards folder at least once
In the 3 - Sales & Marketing Adoption dashboard, edit the New LEAD Trend by Source component and uncheck the Use chart as defined in source report option
Change the dashboard component for New LEAD Trend by Source to a pie chart and set the wedges to Lead Source
Save your changes
Having trouble installing your app? Read this article for help
Hi Everyone,

I am trying to complete my superbadge of  Einstein Analytics and Discovery Insights Specialist and facing the error : 

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: LVROSXAB

Please help me to solve it.

User-added image

Any help would be highly appreciated.

Regards,
Akash Garg
Greetings everyone,
     I recently created a process to automatically create service contract records whenever an oportunity is set to 'closed won', and then to notify the tech lead in charge of the project using an email alert. The email is supposed to contain a link to the created record. The email template itself contains a working link for service contracts, but when the tech lead gets the email alert, the link doesnt appear.

     Does anyone have any advice for getting this to work? I would greatly appreciate any insight on the matter.

Regards, 
Connor
Hi Team,
Please help me on below formula as each and every line with expaination.

IF( 
ISPICKVAL( Severity__c , "Critical")&& ISBLANK(Plan_Due_By_Date__c ), CASE( MOD(Today()-DATE(1900, 1, 7),7),0,Plan_Due_By_Date___c+2+10, 
1,Plan_Due_By_Date___c+4+10,  
2,Plan_Due_By_Date___c+4+10, 
3,Plan_Due_By_Date___c +4+10, 
4,Plan_Due_By_Date___c +4+10, 
5,Plan_Due_By_Date___c+4+10, 
Plan_Due_By_Date___c+3+10), 
IF( 
ISPICKVAL( Severity__c , "High")&&ISBLANK(Plan_Due_By_Date__c ), CASE( MOD(Today()-DATE(1900, 1, 7),7),0,Plan_Due_By_Date___c+2+10, 
1,Plan_Due_By_Date___c+4+10, 
2,Plan_Due_By_Date___c+4+10, 
3,Plan_Due_By_Date___c +4+10, 
4,Plan_Due_By_Date___c +4+10, 
5,Plan_Due_By_Date___c+4+10, 
Plan_Due_By_Date___c+3+10), 
IF( 
ISPICKVAL( Severity__c , "Medium")&&ISBLANK(Plan_Due_By_Date__c ), CASE( MOD(Today()-DATE(1900, 1, 7),7),0,Plan_Due_By_Date___c+6+20, 
1,Plan_Due_By_Date___c+8+20, 
2,Plan_Due_By_Date___c+8+20, 
3,Plan_Due_By_Date___c +8+20, 
4,Plan_Due_By_Date___c +8+20, 
5,Plan_Due_By_Date___c+8+20, 
Plan_Due_By_Date___c+7+20), 
IF( 
ISPICKVAL( Severity__c , "Low")&&ISBLANK(Plan_Due_By_Date__c ),CASE( MOD(Today()-DATE(1900, 1, 7),7),0,Plan_Due_By_Date___c+10+30, 
1,Plan_Due_By_Date___c+12+30, 
2,Plan_Due_By_Date___c+12+30, 
3,Plan_Due_By_Date___c+12+30, 
4,Plan_Due_By_Date___c+12+30, 
5,Plan_Due_By_Date___c+12+30, 
Plan_Due_By_Date___c+41),Plan_Due_By_Date__c 



)

Thanks in advance

Thanks,
Venkat.
We couldn't find a user named 'Noah Larkin' with the configuration specified in the project. Be sure you have entered the user information correctly.User-added image
Hi Devs! I'm starting a SuperBadge in Einstein Analytics (Einstein Analytics and Discovery Insights Specialist), currently doing the first challenge.
We need to do a chart that shows this fómula:
:User-added image

I already got Current Quarter Cancellations, but I can't do this purple square. How can I get previous quarter cancellations and subscribers?
I'm reading about windowing function, but I can't build my code.
 
q = load "Beattie_Subs";
q = filter q by 'Churn' == "Yes";
q = group q by ('Churn','Churn_Date_Year', 'Churn_Date_Quarter');
q = foreach q generate 'Churn' as 'Churn', 'Churn_Date_Year' + "~~~" + 'Churn_Date_Quarter' as 'Activity_Date(Year-Quarter)', count() as 'CurrentQuarterCancellations';
q = order q by ('Churn' asc, 'Activity_Date(Year-Quarter)' asc);

q1 = foreach q generate 'Churn_Date_Year' + "~~~" + 'Churn_Date_Quarter' as 'Activity_Date(Year-Quarter)', count() as CurrentQuarterCancellations;
sum(count(CurrentQuarterCancellations)) over ([-1 .. -1] partition by (Churn_Date_Year, Churn_Date_Quarter) order by 'Churn_Date_Year' + "~~~" + 'Churn_Date_Quarter');

q = limit q 2000;

Thanks <3
I'm stuck on step #2 of Einstein Analytics and Discovery Insights Specialist superbadge.  I'm getting this warning while checking the challenge:
Challenge #2 Not complete
The step "Churn Tenure' is in compact form, so the filter values need to be specifed as a minimum and maximum
The static step that feeds has the following the value:
 
"Tenure_Length": {
                "broadcastFacet": false,
                "label": "Tenure Length",
                "selectMode": "single",
                "type": "staticflex",
                "values": [
                    {
                        "display": "High Risk",
                        "value": "1 to 12 months",
                        "min": 1,
                        "max": 12
                    },
                    ...
                ]
            }


I'm using selection binding for min and max values.  The dashboard is correctly filtering:
User-added image
User-added image
Any ideas? 
I've tried a non-compact form step where I inject a saql fragment into the query, as well as where I inject min/max values using a range filter serialization...All these efforts end in the same challenge failure message.

Any help/suggesitions are welcome!
Hi all,

I am trying to use lightning:fileUpload in my lightning page and I am getting an error saying can't upload while uploading the file..

Component:

<aura:component implements="force:lightningQuickAction,flexipage:availableForAllPageTypes" access = "global">
    
    <aura:attribute name="displayedSection" type="string" default=""/>
    <aura:attribute name="accept" type="List" default="['.jpg', '.jpeg']"/>
    <aura:attribute name="multiple" type="Boolean" default="true"/>
    <aura:attribute name="disabled" type="Boolean" default="false"/>
    <br></br>
    <br></br>
    <br></br>
    <aura:attribute name="options" type="List" default="[
                                                        {'label': 'Cash Claim', 'value': '0127F000000EPoKQAW'},
                                                        {'label': 'Cell Phone Claim', 'value': '0127F000000EPoUQAW'},
                                                        {'label': 'Broadband Claim', 'value': '0127F000000EPoPQAW'},
                                                        {'label': 'Petrol &amp; Driver Claim Phone', 'value': '0127F000000EPoZQAW'}]"/>
    <aura:attribute name="value" type="String"/>
    <div class="slds-box">
        <div aura:id="firstsection" class="{!if(v.displayedSection == '','slds-show','slds-hide')}">
            <lightning:radioGroup name="radioGroup"
                                  label="Claim Record Type"
                                  options="{! v.options }"
                                  value="{! v.value }"
                                  type="radio"
                                  onclick= "{!c.displaySection2}"/>
        </div>
    <br><br>
        </br></br>    
    
    <div aura:id="secondsection" class="{!if(v.displayedSection == 'secondsection','slds-show','slds-hide')}">
        <lightning:recordEditForm aura:id="recordViewForm" recordTypeId="{!v.value}" objectApiName="Claim_Request__c"> 
            <lightning:messages />  
            
            
            <lightning:inputField fieldName="Claim_Amount__c" required = "true" />
            <lightning:inputField fieldName="Claim_Month__c" required = "true" />
            <lightning:inputField fieldName="Claim_Year__c" required = "true"/>
            <lightning:inputField fieldName="Description__c" />
            <lightning:inputField fieldName="Phone_Number__c" default = "In case of cell phone claim"/>
            <lightning:inputField fieldName="Broadband_Number__c"  default = "In case of broadband claim" />
            
            <lightning:button aura:id="submit" type="submit" label="Create Claim" class="slds-m-top_medium" onclick = "{!c.showSuccessToast}" /> 
            
        </lightning:recordEditForm>        

        <lightning:fileUpload label="Add attachment" multiple="{!v.multiple}" 
                          accept="{!v.accept}" recordId="{!v.value}" 
                          onuploadfinished="{!c.handleUploadFinished}" />
        
        
    </div>
</div>
</aura:component>

controller: 

({
    displaySection1 : function(component, event, helper) {
        component.set("v.displayedSection","firstsection");
        var action = component.find("v.value");
    },
 
    displaySection2 : function(component, event, helper) {
        var action = component.get("v.value");
        //action.setParams({
        //    "ID": component.get("v.recordId")          
        //})
        //component.find("firstsection");
        ///component.set("v.displayedSection","section1");
        component.set("v.displayedSection","secondsection");
        console.log("Claim Request has been submitted");
        
    },
    
    handleUploadFinished : function(component, event, helper) {
        var uploadedFiles = event.getParam("files");
        var documentId = uploadedFiles[0].documentId;
        var fileName = uploadedFiles[0].name;
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "File "+fileName+" Uploaded successfully."
        });
        toastEvent.fire();
        
        $A.get('e.lightning:openFiles').fire({
            recordIds: [documentId]
        });
        
    },
    
    showSuccessToast : function(component,event,helper)
    {
        var newClaimRequest = {'objectApiName' : 'claim_request__c', 
                               'claim_amount__c' : '', 
                               'claim_month__c' : '',
                               'claim_year__c' : '',
                               'claim_description__c' : '',
                               'Phone_Number__c' : '',
                               'Broadband_Number__c' : ''
                              };
        //resetting the Values in the form
        component.set("v.recordViewForm",newClaimRequest); 
        
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "claim request has been successfully submitted"
        });
        toastEvent.fire();
    }  
});

please help, tried a lot and not able to identify what's missing.
Hi, I am getting the above error when I am executing a lioghtning component.

Below is my code, please help!

Lightning Component :

<aura:component controller="ClaimRequest"    implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" 
                access="global" >
    
    <!-- Include Static Resource-->
    <ltng:require styles = "/resource/SLDS/styles/salesforce-lightning-design-system.min.css"/>
    <!--scripts="/resource/bootstrap/js/jquery.js,/resource/bootstrap/js/bootstrap.min.js"/>-->
    
    <!-- Define Attribue-->
    <aura:attribute name="claimrequest" type="Claim_Request__c" default="{'sobjectType': 'Claim_Request__c',
                                                                         'Claim_Amount__c' : '',
                                                                         'Claim_Date__c' : '' ,
                                                                         'Claim_Month__c' : '',
                                                                         'Claim_Year__c' : '' ',
                                                                         'Claim_Description__c' : '',
                                                                         'Claim__Type__c' : '',
                                                                         'Open_Date__c' : ''
                                                                         }"/>
     <div class="container-fluid">
        <h3>Please Enter The Claim Information</h3>
        <div class="form-group">
            <label>Claim Amount</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Amount__c}"/>
        </div>
        <div class="form-group">
            <label>Claim Date</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Date__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Month</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Month__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Year</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Year__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Description</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Description__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Type</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Type__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Open Date</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Open_Date__c}"/>
        </div>
         
         <div class="col-md-4 text-center">
        <ui:button class="btn btn-default" press="{!c.create}">Create</ui:button>
  </div>
    </div>
</aura:component>

JS controller
({
    create : function(component, event, helper) {
        console.log('Create record');
        
        //getting the claim information
        var claimrequest = component.get("v.claimrequest");
        
        //Validation
        if($A.util.isEmpty(claimrequest.Claim_Amount__c) || $A.util.isUndefined(claimrequest.Claim_Amount__c)){
            alert('Claim Amount is Required');
            return;
        }            
        if($A.util.isEmpty(claimrequest.Claim_Date__c) || $A.util.isUndefined(claimrequest.Claim_Date__c)){
            alert('Claim Date is Rqquired');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Month__c) || $A.util.isUndefined(claimrequest.Claim_Month__c)){
            alert('Claim Month is Required');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Year__c) || $A.util.isUndefined(claimrequest.Claim_Year__c)){
            alert('Claim Year is Required');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Type__c) || $A.util.isUndefined(claimrequest.Claim_Type__c))
        {
            alert('Claim Type is required');
        }
        if($A.util.isEmpty(claimrequest.Open_Date__c) || $A.util.isUndefined(claimrequest.Open_Date__c))
        {
            alert('Claim Open Date is required');
        }
        
        //Calling the Apex Function
        var action = component.get("c.createRecord");
        
        //Setting the Apex Parameter
        action.setParams({
            claimrequest : claimrequest
        });
        
        //Setting the Callback
        action.setCallback(this,function(a){
            //get the response state
            var state = a.getState();
            
            //check if result is successfull
            if(state == "SUCCESS"){
                //Reset Form
                var newClaimRequest = {'sobjectType': 'Claim_Request__c',
                                    'Claim_Amount__c' : '',
                                    'Claim_Date__c' : '' ,
                                    'Claim_Month__c' : '',
                                    'Claim_Year__c' : '',
                                    'Claim_Description__c' : '',
                                    'Claim__Type__c' : '',
                                    'Open_Date__c' : ''                                     
                                   };
                //resetting the Values in the form
                component.set("v.claimrequest",newClaimRequest);
                alert('Record is Created Successfully');
            } else if(state == "ERROR"){
                alert('Error in calling server side action');
            }
        });
        
        //adds the server-side action to the queue        
        $A.enqueueAction(action);

    }
})

Controller Class

public with sharing class ClaimRequest {
    /**
   * Create a new claim request Record
   *
   * @param Claim_Request__c claimrequest  claimrequest record to be inserted
   * 
   */
    @AuraEnabled
    public static void createRecord (Claim_Request__c claimrequest){
        
        try{
            System.debug('ClaimRequest::createRecord::claimrequest'+claimrequest);
            
            if(claimrequest != null){
                insert claimrequest;
            }
            
        } catch (Exception ex){
            
        }
        
    } 

}

Thanks in Advance!
Hello,

I am trying to create a visualforce page listing all the etitlements based on the userId. I have created a global class and using its function in a different class and when I am trying to show the data on the vf page it is showing me the error.

Here is my code: 
VF page

<apex:page standardcontroller="Claim_Request__c" extensions="EntitlementData" >
        <html>
            <head>
           
            </head>
            <body>
                <apex:pageBlock title="Entitlement details of the employee">
                    <apex:pageBlockSection columns="1">
                        <apex:form >
                            
                                <table>
                                    <tr>
                                        <th>Entitlement Type</th>
                                        <th>Entitlement Amount</th>
                                         <th>Entitlement Applicability</th>
                                    </tr>
                                    <apex:repeat value="{!entitlements}" var="entitle">
                                           <apex:repeat value="{!entitlements[entitle]}" var="map">

                                    <tr>
                                        <td><apex:outputfield value="{!map.Entitlement_Type__c}" /></td>
                                        <td><apex:outputfield value="{!map.Entitlement_Amount__c}"/></td>
                                        <td><apex:outputfield value="{!map.Applicability__c}"/></td>
                                    </tr>
                                        </apex:repeat>
                                    </apex:repeat>
                                </table>    
                                <br/>
                            
                        </apex:form>
                    </apex:pageBlockSection>
                </apex:pageBlock>
            </body>
        </html>
</apex:page>

Controller

public class EntitlementData 
{   
    Map<Id, Object > entitlements {get;set;}
    
    public user usr;
    public EntitlementData(ApexPages.StandardController controller )
    {
        
        List <Id> lst = new list<Id>();
           TESTQurty bg1 = new TESTQurty();
    
        //query to take out the current user department information
        user usr = [select id from user where id =: Userinfo.getUserId()]; 
           lst.add(usr.Id);
        entitlements = bg1.getEmployeeEntitlements(lst);
    }
}

Global Class

public class TESTQurty {
    // Global Enums 
    public enum APPLICABILITY {MONTHLY, ANNUALLY}
    public enum CATEGORY {ORGANIZATIONAL, DEPARTMENTAL}
   
    // Global Constants
    public final String ENTL_DPT_REC_TYPE = 'Department Entitlement';
    public final String ENTL_GBL_REC_TYPE = 'Global Entitlement';
   
    public User usr;
  
    // Global data structures
    // To Store Entitlement Information
    public class Entitlements {
        Decimal Amount {get;set;}
        String Type {get;set;} // Entitlement Types e.g. Phone, Broadband etc.
        APPLICABILITY Applicability {get;set;}
        CATEGORY Category {get;set;}
        
        public Entitlements(Decimal Amt, String EType, APPLICABILITY apl, CATEGORY cat)
        {
            Amount = Amt; 
            Type=EType; 
            Applicability=apl; 
            Category=cat;
            
        }
    }
    
    // To Store Claimed Data
    public  class ClaimedInfo {
        Decimal Amount {get;set;}
        String Type {get;set;} // Entitlement Types e.g. Phone, Broadband etc.
        String Month {get;set;} 
        String Year {get;set;}
        
        public ClaimedInfo(Decimal amt, String cType, String mon, string yr)
        {
            amount = amt;
            Type = cType;
            month = mon;
            year= yr;
        }
    }
    
    // Utility method to get the list of all entitlements 
    // applicable to the given list of employee ids
    public Map<Id, List<Entitlements>> getEmployeeEntitlements(List<Id> EmployeeIds){
        
        
        // Local variables
        Map<Id, List<Entitlements>> mapEntilementsByEmpIds = new Map<Id, List<Entitlements>>();
        Map<Id, List<Entitlements>> mapEntilementsByDepts = new Map<Id, List<Entitlements>>();
        List<Entitlement__c> lstEntitlementsByEmp = new List<Entitlement__c>();
        List<Entitlements> lsEntitlementGlobal = new List<Entitlements>();
        
        // Get list of departments for the given list of employees
        //Set<Id> lstDepartments = new Set<Id>();
        Map<Id,Id> mapDeptByEmp = new Map<Id, Id>();
        // Query Employee and get Department details
        for(Employee__c emps: [SELECT Id,Department_Number__c from Employee__c where Id =: EmployeeIds]){
            // Check if exist in the set if not then add
            if(!mapDeptByEmp.containsKey(emps.id))
                mapDeptByEmp.put(emps.id, emps.Department_Number__c);    
            
        }// End of for
        System.debug('Emp By Dept : ' + mapDeptByEmp);
        
        
                
        // Query Entitlements Object to get list of all entitlements 
        for(Entitlement__c entl : [SELECT Entitlement_Type__c,
                                        Entitlement_Amount__c,
                                        Applicability__c,
                                        RecordType.Name,
                                        Department_Number__c
                                    FROM Entitlement__c 
                                    WHERE 
                                        (Department_Number__c = : mapDeptByEmp.values()
                                    AND RecordType.Name =: ENTL_DPT_REC_TYPE) 
                                     OR RecordType.Name =: ENTL_GBL_REC_TYPE]){
            
            // Check if this is the record is global or departmental
            if(entl.RecordType.Name == ENTL_GBL_REC_TYPE){
                lsEntitlementGlobal.add(new Entitlements (entl.Entitlement_Amount__c,
                                                          entl.Entitlement_Type__c,                                                    
                                                         (entl.Applicability__c=='Monthly')?APPLICABILITY.MONTHLY:APPLICABILITY.ANNUALLY,
                                                         CATEGORY.ORGANIZATIONAL
                                                         ));
            } else if(entl.RecordTYpe.Name == ENTL_DPT_REC_TYPE )    {        
            
                    // Check if employee exists in the map
                    if (!mapEntilementsByDepts.containsKey(entl.Department_Number__c) ){
                        
                        List<Entitlements> lstEntitlement = new List<Entitlements>();
                        
                        lstEntitlement.add(new Entitlements(entl.Entitlement_Amount__c,
                                                          entl.Entitlement_Type__c,                                                    
                                                         (entl.Applicability__c=='Monthly')?APPLICABILITY.MONTHLY:APPLICABILITY.ANNUALLY,
                                                         CATEGORY.DEPARTMENTAL));
                        
                        mapEntilementsByDepts.put(entl.Department_Number__c, lstEntitlement);
                        
                    } else {
                        

                        mapEntilementsByDepts.get(entl.Department_Number__c).add(new Entitlements(entl.Entitlement_Amount__c,
                                                                                                  entl.Entitlement_Type__c,                                                    
                                                                                                  (entl.Applicability__c=='Monthly')?APPLICABILITY.MONTHLY:APPLICABILITY.ANNUALLY,
                                                                                                  CATEGORY.DEPARTMENTAL));
                        
                    } /// End of Check if employee exists in the map
            
            
            } // End of else if
        
        } // End of for
        system.debug(lsEntitlementGlobal);
        system.debug(mapEntilementsByDepts);
        
        
        
        // Populate the final out put map based on employee
        for(Id empId:EmployeeIds ){
            
            
            // Add departmental entitlements for the employee
            mapEntilementsByEmpIds.put(empId, mapEntilementsByDepts.get(mapDeptByEmp.get(empId)));        
                        
            // Add global list applicable for the employee
            mapEntilementsByEmpIds.get(empId).addAll(lsEntitlementGlobal);
        }// End of for        
        
        return mapEntilementsByEmpIds;
        
    } // End of getEmployeeEntitlements

Thanks in Advance
Hey,

I have used lighning datatable to show my custom object fields on thr browser but I am not getting any data on my screen.

Below is the code I have written:

This is my main component:

<aura:component implements="force:appHostable" controller="EntitlementListControllerx">
    
    <!-- attributes -->
    <aura:attribute name="data" type="Object"/>
    <aura:attribute name="columns" type="List"/>
    
    <!-- handlers-->
    <aura:handler name="init" value="{!c.doInit }" action="{!this }"/>


    <!-- the container element determine the height of the datatable -->
    <div style="height: 300px">
        <lightning:layout horizontalAlign="space">
            <lightning:layoutItem size="12">
                <lightning:datatable
                                    keyField="id"
                                    data="{! v.data }"
                                    columns="{! v.columns }"
                                    hideCheckboxColumn="true"/>
                </lightning:layoutItem>
        </lightning:layout>
    </div>
</aura:component>

Controller:

({
    doInit: function (cmp, event, helper) {
        cmp.set('v.columns', [
            {label: 'Entitlement Name', fieldName: 'Name', type: 'text'},
            {label: 'Entitlement Number', fieldName: 'Entitlement_Name__c', type: 'text'},
            {label: 'Entitlement Amount', fieldName: 'Entitlement_Amount__c', typeAttributes: { currencyCode: 'USD'}},
            {label: 'Entitlement Type', fieldName: 'Entitlement_Type__c', type: 'text'},
        ]);

        helper.getEntitlement(cmp,helper);
    }
})

Helper:\

({
    getEntitlement : function(cmp) {
        helper.callServer(cmp,"c.getEntitlementList",
                                   function(response){
                                       for(var i=0; i>response.length; i++){
                                           var row = response[i];
                                           row.Owner = row.Contact__r.Name;
                                       }
                                        cmp.set("v.data", response);//set data in the page variable
        });
    }
})

Controller to fetch the data:

public with sharing class EntitlementListControllerx     
{
     @AuraEnabled//Annotation to use method in lightning component
    
    public static List<Entitlement__c> getEntitlementList() 
    {//Fetch data
        return [SELECT Id,Name,Entitlement_Name__c, Entitlement_Amount__c, Entitlement_Type__c, CreatedDate FROM Entitlement__c];
    }    
}

Please help!
Hi,

I got following error on step 3.

Challenge Not yet complete... here's what's wrong: 
Couldn’t find Agency records from the Account object.

Can anyone pass this step?
Thanks in advance.

Regards,
LinThaw
Hello all, I receive the following message in Trailhead. I think that the exploration and filter are set up properly. I don't know what I am doing wrong. Would you please help?
I am unable to complete the hands-on challenge "Create a lens that shows which industry is buying the most laptops" I continue to receive the following error even after multiple attempts.

"Challenge Not yet complete... here's what's wrong: 
The 'Top Laptop Industry' lens does not appear to have the correct query. Please check the requirements and ensure everything is setup correctly."
​I keep getting

Challenge Not yet complete... here's what's wrong: 
The 'Top Laptop Industry' lens was not found. Please follow the requirements and ensure everything is setup correctly


I have named the Lens as step 2 - Enter D01 - Laptops Salespeople - Wall of Fame as the title AND/OR result set Top Laptop Industry

Neither seem to work. I have refresed the screen, even cleared cookies and rebooted the computer.