• Dinesh_Kumar_Nagarathinam
  • NEWBIE
  • -2 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 2
    Questions
  • 10
    Replies
I have created a custom visualforce quick action in a lightning environment. The quick action randered the vf page in desktop but not in mobile, that too in sandbox Org only. When i tested the same vf quick action in my personal development org, it was working as expected in mobile.
Lightning Component Framework Specialist Superbadge Step 6 Issue
Lightning Specialist Superbadge Issue
creating a record in a custom object using the form approach in lightning component, but it is returning a null id.
following is the code of component:-
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId"
                access="global" controller="createUserRecord">
    <aura:attribute name="newUser" type="User_Request__c" default="{'sobjectType':'User_Request__c',
                                                                   'First_Name__c':'',
                                                                   'Last_Name__c    ':'',
                                                                   'Email__c':'',
                                                                   'X521_ID__c':'',
                                                                   'Company_Phone__c':'',
                                                                   'Model_User__c':'',
                                                                   'Requestor_s_521__c':'',
                                                                   'Username__c':'',
                                                                   'Manager_Email__c':'',
                                                                   'Manager__c':'false' ,
                                                                   'Country_Code__c':'',
                                                                   'Deactivation_Date__c':''}"  />

        <fieldset class="myBoxArea">
    <lightning:layout verticalAlign="end">
        <lightning:layoutItem >
            <div class="blue">                 
                envision CRM and Commercial Application Access Request ALCON 
            </div>
            <div class="white">
            </div>
        </lightning:layoutItem>
    </lightning:layout>
        <div class="slds-align_absolute-center slds-box lightblue" style="height: 5rem;">
            USER INFORMATION
        </div>  
        <lightning:layout class="slds-box">
            <lightning:layoutItem size="6" class="left-align">
                <div >
                    <form class="slds-form slds-form_horizontal">          
                        <lightning:input aura:id="itemform" label="First Name"
                                         name="itemname"
                                         type="input text"
                                         value="{!v.newUser.First_Name__c}"/> 
                        <lightning:input aura:id="itemform" label="Username"
                                         name="itemname"
                                         type="input text"
                                         value="{!v.newUser.Username__c}"/> 
                        <lightning:input aura:id="itemform" label="Manager's Email"
                                         name="itemname"
                                         type="email"
                                         value="{!v.newUser.Manager_Email__c}"/>
                        <lightning:input aura:id="itemform" label="Copy profile from"
                                         name="itemname"
                                         type="input text"
                                         value="{!v.newUser.Model_User__c}"/>
                        <lightning:input aura:id="itemform" label="Access End Date"
                                         name="itemname"
                                         type="date"
                                         value="{!v.newUser.Deactivation_Date__c}"/> 
                        <lightning:input type="toggle" label="Manager"
                                         name="option1"
                                         aura:id="itemform" 
                                         value="{!v.newUser.Manager__c}"/> 
                    </form>
                </div>
            </lightning:layoutItem>
            <lightning:layoutItem size="6" class="right-align">
                <div >
                    <form class="slds-form slds-form_horizontal">          
                        <lightning:input aura:id="itemform" label="Last Name"
                                         name="itemname"
                                         type="input text"
                                         value="{!v.newUser.Last_Name__c}"/> 
                        <lightning:input aura:id="itemform" label="Email Address"
                                         name="itemname"
                                         type="email"
                                         value="{!v.newUser.Email__c}"/>
                        <lightning:input aura:id="itemform" label="User 5-2-1"
                                         name="itemname"
                                         type="input text"
                                         value="{!v.newUser.X521_ID__c}"/>
                        <lightning:input aura:id="itemform" label="Company/Mobile Phone #"
                                         name="itemname"
                                         type="input text"
                                         value="{!v.newUser.Company_Phone__c}"/> 
                        <lightning:input aura:id="itemform" label="Requestor 5-2-1"
                                         name="itemname"
                                         type="input text"
                                         value="{!v.newUser.Requestor_s_521__c}"/> 
                        <lightning:input aura:id="itemform" label="Country"
                                         name="itemname"
                                         type="input text"
                                         required="true"
                                         value="{!v.newUser.Country_Code__c}"/>
                    </form>
                </div>
            </lightning:layoutItem>
        </lightning:layout>
        <lightning:layout>
            <lightning:layoutItem class="slds-align_absolute-center">        
                        <lightning:button label="Send for approval" 
                                          class="slds-m-top--medium"
                                          variant="brand"
                                          onclick="{!c.save}"/>
            </lightning:layoutItem>
        </lightning:layout>      
    </fieldset>
</aura:component>
apex class is:-
public class createUserRecord {
    @auraenabled
    public static id createUserRecordNew(User_Request__c UR){
     upsert UR;
    return UR.id;
}    }
controller i am using is:-
({
 save : function(component, event, helper) {     
     var action = component.get("c.createUserRecordNew");
            action.setParams({"UR":component.get("v.newUser")});
            action.setCallback(this,function(result){
            component.set("v.isShow",false);
            var userId = result.getReturnValue();
            alert('userId'+userId); 
        });
         $A.enqueueAction(action);
 }
})
app for execution:-
<aura:application extends="force:slds">
    <c:newTest/>    
</aura:application>
I have created a custom visualforce quick action in a lightning environment. The quick action randered the vf page in desktop but not in mobile, that too in sandbox Org only. When i tested the same vf quick action in my personal development org, it was working as expected in mobile.
VF Page
~~~~~~~~~~~~~~~~~~
<apex:page standardController="Account" cache="true" extensions="BussinessController" sidebar="false" showHeader="false">
<head>
    <title>Trade History - {!Account.Name}</title>
</head>
<apex:pageMessages />

    <script>
        function setFocusOnLoad() {} 
    </script>
  
    <apex:form id="th_form">
    <table>
    <tr>
    <td width="230px">
    <apex:selectRadio value="{!report}" style="font-weight: bold;">
        <apex:selectOptions value="{!reporttypes}"/>
    </apex:selectRadio>
    </td>
    <td width="250px">
    <apex:OutputLabel value="Start Date" for="c_startDate" />
    &nbsp;&nbsp;&nbsp;&nbsp;
    <apex:inputField id="c_startDate" value="{!Start.ActivityDate}" />
    </td>
    <td width="250px">
    <apex:OutputLabel value="End Date" for="c_endDate" />
    &nbsp;&nbsp;&nbsp;&nbsp;
    <apex:inputField id="c_endDate" value="{!End.ActivityDate}" />
    </td>
    <td>
    <apex:commandButton action="{!th_loaddata}" value="Retrieve Data"  status="thtab_status"/>
    </td>
    </tr>
    </table>
    </apex:form>
    

    <apex:outputPanel id="th_out">
    <apex:actionstatus id="thtab_status" startText="Requesting...">
    <apex:facet name="stop">
        <apex:outputPanel >
            &nbsp;&nbsp;&nbsp;&nbsp;
            <apex:outputText value="{!ErrorMessage}" style="font-style:italic; font-weight: bold; font-size: 12px;color: #AF0B1C;"/>            
            <p/>            


<apex:iframe src="https://cognos-prod" />


            
        </apex:outputPanel>
    </apex:facet>
    </apex:actionstatus>
    </apex:outputPanel>
    <p/>
</apex:page>
                   

Apex Class:
~~~~~~~~~~~~~~~~~


public with sharing class BUssinessController {
    
   
    
    private Account acct;
    
    
    private String report = '1';
    private Task edit_task1=null;
    private Task edit_task2=null;
    private String s_StartDate = null;
    private String s_EndDate = null;
    private String s_ErrorMessage = '';
    private Boolean bshow_thMashup = true;
    private String userId = '';
    private Spotfire sptfire = new Spotfire();
         
        
    
    public String FICClientID
    {
        get { return sptfire.ficClientID;}
        set;
    }
    
    
    public Task getStart()
    {        
        return edit_task1;
    }
    
    public Task getEnd()
    {        
        return edit_task2;
    }
    
    public String getStartDate()
    {
        if(edit_task1 == null || edit_task1.ActivityDate==null ) return '';
        else return s_StartDate;
    }
    
    public String getEndDate()
    {
        if(edit_task2 == null || edit_task2.ActivityDate==null) return '';
        else return s_EndDate;        
    }
    
    public String getErrorMessage()
    {
        return s_ErrorMessage;
    }
    
    public Boolean show_thMashup
    {
        get{return bshow_thMashup;}
        set;
    }
    
        
    public PageReference th_loaddata() {
        
        s_ErrorMessage='';
        
        if(report == '1')
        {
            s_StartDate='';
            s_EndDate='';
            edit_task1.ActivityDate = null;
            edit_task2.ActivityDate = null; 
            bshow_thMashup=true;        
        }
        else
        {
            System.debug('report by date range!!! ' + edit_task1.ActivityDate + ', '+ edit_task2.ActivityDate);
            if(edit_task1.ActivityDate == null || edit_task2.ActivityDate==null)
            {
                s_ErrorMessage = 'WARNING! Please enter a date range before retrieving data.';
                bshow_thMashup=false;
            }
            else if(edit_task1.ActivityDate > edit_task2.ActivityDate )
            {
                System.debug('ERRROR 2 is set');
                s_ErrorMessage = 'WARNING! The end date must occur after the selected start date.';
                bshow_thMashup=false;  
            }
            else
            {
                bshow_thMashup=true;
                System.debug('NO ERROR for radio2!!');
                Date ds = edit_task1.ActivityDate; 
                String s_year = String.valueOf(ds.year());
                String s_month = String.valueOf(ds.month());
                if(s_month.length()<2) s_month = '0' + s_month;
                String s_day = String.valueOf(ds.day());
                if(s_day.length()<2) s_day = '0' + s_day;
                s_StartDate = s_year+s_month+s_day;
        
                Date de = edit_task2.ActivityDate; 
                String e_year = String.valueOf(de.year());
                String e_month = String.valueOf(de.month());
                if(e_month.length()<2) e_month = '0' + e_month;
                String e_day = String.valueOf(de.day());
                if(e_day.length()<2) e_day = '0' + e_day;
                s_EndDate = e_year+e_month+e_day;           
            }
        }
            
           
        return null;
    }
    
    public List<SelectOption> getreporttypes() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('1','Last 20 Deals'));
        options.add(new SelectOption('2','By Date Range:'));
        return options;
    }
    
    public String getreport() {
        return report;
    }
    
    public void setreport(String r) 
    { 
        this.report = r; 
    }
    
    
    public string Url {   
     get     { return GeneralSettings.getValue(GeneralSettings.SpotfireURL);  
              } 
                      } 
         
    //=================================================================== 
    // Constructor
    //             
    public BUssinessController(ApexPages.StandardController stdController)
    //===================================================================  
    {
        Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=10');        
        
        this.acct= (Account)stdController.getRecord();
        userId = UserInfo.getUserId();   
        
              
        sptfire.getSpotfireParams(this.acct.Id);
        
        // Initialize tasks        
        edit_task1= new Task();
        edit_task1.OwnerId = userId; 
        edit_task1.Priority = 'Normal';
        edit_task1.ActivityDate = System.TODAY();
        
        edit_task2= new Task();
        edit_task2.OwnerId = userId; 
        edit_task2.Priority = 'Normal';
        edit_task2.ActivityDate = System.TODAY();
               
        
    }

}
I have a lightning datatable which is having various no. of columns.
Problem is that User has to scroll to right end to find the vertical scrollbar, I want the vertical scroller to be on the screen always so that whenver user wants to scroll down he can do it through scroller.
Please suggest any ideas how to achieve this.
DatatableDatatable vertical scroller
I am implementing lightning:tabset and lightning:tab to display tabs in a lightning component. I have 2 tabs inside the tabset. I am trying to display error when user tries to fill tab 2 first by leaving tab 1 fields empty. Does anyone have any insight into how
 to achieve this functionality?
I am using lightning:treegrid to display hierarchy of accounts.
When I select a child from the hierarchy and then collapse its parent and expand again - the selection is gone.

This is also reproducible in the lightning component library
https://developer.salesforce.com/docs/component-library/bundle/lightning:treeGrid/example

Expand/Collapse should not affect any selection.
Hi,

When I am trying to convert a array of task into JSON string in my lightning controller, only the 1st element is returned always even though the array has more values. Here is the code. Has anyone faced the same issue.

Component:
<aura:attribute type="Task[]" name="listTask" />

Controller:
var taskList = component.get("v.listTask"); //tried var taskList = component.get("v.listTask").slice(); as well
console.log(taskList.length); //Length is returned correctly e.g. 3

//converting the array into JSON string
var JSONStr = JSON.stringify(taskList); 
console.log(JSONStr); // [{"sobjectType":"Task","ActivityDate":"2016-3-3","Status":"In Progress","Subject":"task1"},[],[]]
Hello,

I'm having issues communicating to a nested component. I would like a component to be able to run a method in the nested-component's controller.js (or helper). I have tried both events and via and no luck. Here is the example markup:
 
<!-- myEvent.evt --> 
<aura:event type="APPLICATION"> 
</aura:event> 

<!-- super-component --> 
<aura:component>
    <aura:registerEvent name="myEventName" type="c:myEvent"/> 
    <c:my_Nested_Component /> 
    <ui:button press="{!fireEvent}" 
<aura:component> 

//super-component_controller.js 
({ 
    fireEvent: function(component){ 
        var myEvent = component.getEvent("myEventName"); 
        myEvent.fire(); 
        console.log('event fired'); 
    } 
}) 

------------------------------------------ 

<!-- nested-component --> 
<aura:component> 
    <aura:handler name="myEventName" event="c:c:myEvent" action="{!c.gotEvent}" /> 
<aura:component> 

//nested-component_controller.js 
({ 
    gotEvent: function(component, event){ 
        console.log('received event!'); 
    } 
})

This does not work. I tried the same exact code that I placed on the nested-component on a super-super-component, and it worked perfectly.The super-super component received the event. But the nested component is not able to. I figured this had to do with events only bubbling up (though the documentation does say that that is only the case with Component events, not application events).

So the other option I read online is using . I tried doing this, but this too did not work for speaking to a nested component.

How can a parent component cause a method on the nested component to fire?

Thank you

Hi all,

 

          how to integrate salesforce with chaimp using http callouts, i created mail chimp api key, but what is end point url, where will i get end point url. and how to connect salesforce with mailchimp. 

 

 

Thank you

Hello everyone!
I have an issue with lightning:container. It throws "Failed to load resource: the server responded with a status of 403 (Forbidden)" error upon loading and refuses to load.
I address the resource in the code like so: 
<lightning:container src="{!$Resource.namespace__resourceName + '/index.html'}"/>
The issue seem to reproduce mostly when I'm logged under a user with reduced permissions. However, the issue reproduces when I'm logged under a user with System Administrator profile as well.
Any help would be greatly appreciated!
 

Hi all,

 

          how to integrate salesforce with chaimp using http callouts, i created mail chimp api key, but what is end point url, where will i get end point url. and how to connect salesforce with mailchimp. 

 

 

Thank you