• Gaurav Puranik
  • NEWBIE
  • 50 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 14
    Replies
Hi all,

My component code:-
<aura:set attribute="auraPreInitBlock">
    <auraStorage:init debugLoggingEnabled="true"
                         name="actions"
                         persistent="false" secure="true"
                         clearStorageOnInit="true"
                         defaultExpiration="3600"
                         maxSize="10485760" version="1.0"/>
    </aura:set> 

On the client side controller :-
doInit:function(cmp, evt, helper){
// Get server-side action
var action = cmp.get("c.fetchDataRecord");
action.setCallback(cmp, function(response){
var returnValue = response.getReturnValue();
});
// Set server-side action as storable
action.setStorable();
// Run server-side action
$A.enqueueAction(action);
},

I played with  all attribute maxsize, defaultExpiration but nothing is working out.
If anybody has came across same senario please help.

Many thanks in Advance!!
Hi all,

 - I want to acheive something by using $('.ClassName') in JS controller it is looking like impossible to do that by component.find('aura:id');
 - I am using <ltng:require scripts="{!$Resource.MyNameSpace__MyResourceName}"  /> as per lightning guide to add external source library.
 - I found one blog as well there we have unmanaged package and we can use external libraries below is the link
https://login.salesforce.com/packaging/installPackage.apexp?p0=04tB000000011BS 
But I cannot able to install this package as well..some error is coming..

Anybody has any idea how to overcome this error below is the screenshot for the same
User-added image
Hi All,

I want to hide aura:iteration indexing of same name..here is my code
<aura:iteration items="{!v.payStmtList}" var="paySt" indexVar="index">
            <tr>
                <td> <ui:outputText value="{!paySt.Name}" /></td>
                <td>{!index}</td>
                <td></td>
            </tr>
            <br/>
            <tr>
                <aura:iteration items="{!v.fieldNames}" var="fieldName">
                    <td>
                        <c:PayStatementItem paySt="{!paySt}" fieldName="{!fieldName}"/>
                    </td>
                </aura:iteration>
            </tr>
        </aura:iteration>
I am attaching the file of output.
User-added image
I want to achieve something like when one Month Name is coming in the first iteration "<td> <ui:outputText value="{!paySt.Name}" /></td>".. here december december and november november is coming two/three times I want these values to be once. Anybody has any idea
Hi all,

There is one object let say Account. In Account I have 3 fields, Amount1, Amount2,Amount3. Now when I enter value in Amount1 at the time of creation of account record. Account2 field value get updated by (Amount1+10), that I am doing by before Insert event.

Now I want to update Amount3 field of same record let say by Amount2+40, so for this case I have to go by after insert event. I am doing the same by after insert event but it is throughing an error 'Feild is read only'. 
Hi all,
I want to display lookup feild next to selectList dropdown in vf page. A selectList contains USER and Role in its dropdown. Now what I want here is, when user select User from dropdown and click on lookup icon it should search all Users.

Similarly when user select Role from Dropdown the lookup icon should search all Roles.

 <apex:selectList value="{!strSelectVal}" multiselect="false" size="1">
            <apex:selectOption itemLabel="User" itemValue="User"/>
            <apex:selectOption itemLabel="Role" itemValue="Role"/>
        </apex:selectList>
        <apex:inputField ??

Where strSelectVal is variable in class :-
public String strSelectVal    {get;set;}

 
Hi all,

I want to set input tag value of html of the new append row by jquery...here is my code which I have written 

$(document).ready(function(){
        var evtName = '';
        var OppoId = '{!Opportunity.Id}';
        var query1 =  'SELECT Id,Name,Opportunity__c,Visit_Date__c,Result__c,LastModifiedDate FROM Event__c WHERE Opportunity__c = \'' + OppoId + '\'';
        var records = sforce.connection.query(query1);
        var records1 = records.getArray('records');
       
        console.log(records1);
        if(records1.length >0){
            for(var i=0;i<records1.length;i++){ 
            var evtName = records1[i].Name;
            var evtResult = records1[i].Result__c;
            var evtVisitDate = records1[i].Visit_Date__c; 
            var evtLastDate = records1[i].LastModifiedDate; 
                
                $("#customFields").append('<tr id="trId1" class="tr1Cls">  <td width="1%"> <a style="text-decoration: underline; cursor: pointer;" >Edit</a> </td> <td width="1%"> <a style="text-decoration: underline; cursor: pointer;" onclick="CreateNewEvent(this);">Save</a>  </td> <td width="1%"> <a style="text-decoration: underline; cursor: pointer;">Del</a>  </td>  <td width="10%" style="text-align: center;"> <input  class="datepicker1" value=evtVisitDate></td> <td width="10%" style="text-align: center;"> <input type="text" class="inputCls" value="evtName"  required="true"/> </td> <td width="10%" style="text-align: center;"> <input type="Text" value=evtResult /> </td><td width="20%" style="text-align: center;"><input type="text" value =evtLastDate/></td> </tr> ');
        }

here new row is appending but Im not getting the value evtVisitDate, evtName, evtResult , evtLastDate...the new row is appending with value as 
'evtVisitDate' in the first column
'evtName'  in the second column
'evtResult'  in the third column
'evtLastDate' in the fourth column

 var evtName = records1[i].Name;
            var evtResult = records1[i].Result__c;
            var evtVisitDate = records1[i].Visit_Date__c; 
            var evtLastDate = records1[i].LastModifiedDate; 

whereas, I already defined value of all this variable...

Anyone has any idea on this..
Thanks in advance
I have custom object expense__c and my Lightning namespace is LightningSF1. I want to create a page there I should display Expense object fields.
        There I have created one picklist field and one lookup field but that I don't know how to give those fields for that in component.

THIS IS MY COMPONENT CODE:-

<aura:component >
    <link href='/resource/Boot1' rel="stylesheet"/> 
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="newExpense" type="LightningSF1.Expense__c"
                    default="{ 'sobjectType': 'LightningSF1__Expense__c',
                             'Name': '',
                             'LightningSF1__Amount__c': 0,
                             'LightningSF1__Client__c': '',
                             'LightningSF1__Date__c': '',
                             'LightningSF1__Reimbursed__c': false
                             }"/>
    <div class="row " style="background-color:blue !important;">
        <div  style="text-align:center;font-weight:bold;color:white;">
            Outlet Information
        </div>
    </div>
    <br/>
    <div class="container">
        <div class="row" >
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4" >Expense Name</label>
                    <span class="col-sm-8">
                        <ui:inputText aura:id="expname"
                                      class="form-control"
                                      value="{!v.newExpense.Name}"
                                      placeholder="My Expense" required="true" />
                    </span>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4">Amount</label>
                    <span class="col-sm-8"> 
                        <ui:inputNumber aura:id="amount"
                                        class="form-control"
                                        value="{!v.newExpense.LightningSF1__Amount__c}"
                                        placeholder="20.80" required="true"/>
                    </span>
                </div>
            </div>
            
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4">Client</label>
                    <span class="col-sm-8">
                        <ui:inputText aura:id="client" 
                                      class="form-control"
                                      value="{!v.newExpense.LightningSF1__Client__c}"
                                      placeholder="ABC Co."/>
                    </span>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4">Expense Date</label >
                    <span class="col-sm-8">
                        <ui:inputDateTime aura:id="expdate" 
                                          class="form-control"
                                          value="{!v.newExpense.LightningSF1__Date__c}"/>
                    </span>
                </div>
            </div>
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4">Country</label>
                    <span class="col-sm-8">
                        <ui:outputText aura:id="country" 
                                      class="form-control"
                                      value="{!v.newExpense.LightningSF1__Country__c}"/>
                    </span>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4">Types</label >
                    <span class="col-sm-8">
                      <!-- <aura:attribute name="Name" type="String" /> -->
                    </span>
                </div>
            </div>
        </div>
    </div>
   <div class="col-sm-12">
       <span class="col-sm-6">
    <ui:button label="Submit" press="{!c.createExpense}"/>
       </span>
 <span class="col-sm-6">
     <ui:button label="Cancel" press="{!c.createExpense}"/>
       </span>
    </div>
</aura:component>

Here country is loookup field I want to show on page but fieldset tag
<ui:____for lookup I don't know like we know that tag for inout field is <ui:inputText> same way can anyone tell me tag for Lookup and picklist field...
Hi,

There is a custom checkbox field Auto_Close_Reopen__c for case object. For after update event if the Auto_Close_Reopen__c checkbox checked I want to create new case and want to update Auto_Close_Reopen__c checkbox field value to false. We can achieve it by before update case but I want it to make for after update event. I wrote a trigger for it. but I am getting this error message

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger CaseTrigger caused an unexpected exception, contact your administrator: CaseTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 5009000000mId8xAAC; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CaseTrigger: maximum trigger depth exceeded Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x]: []: Class.CaseHandler.AfterUpdateCase: line 26, column 1

The code of my trigger is 
trigger CaseTrigger on Case (after update) {
    CaseHandler objCase = new CaseHandler();
    
    if(Trigger.isAfter && Trigger.isUpdate){
        objCase.AfterUpdateCase(Trigger.New);
    }
}

Code for Handler class of trigger

public with sharing class CaseHandler {
    list<Case> lstCloneCase = new list<Case>();
    map<Id,Case> mapCase = new map<Id,Case>();
    list<Case> lstUpdateCase = new list<Case>();
    
    public void AfterUpdateCase(list<Case> lstCase){
        for(Case objCase : lstCase){
            mapCase.put(objCase.Id,objCase);
            
            if(objCase.Auto_Close_Reopen__c == true){
                Case objCaseNew = new Case();
                objCaseNew.Status = 'Open';
                ObjCaseNew.Origin = 'Web';
                lstCloneCase.add(ObjCaseNew);
            }
        }
        insert lstCloneCase;
        
        for(Id idd : mapCase.keyset()){
            Case objCase = new Case(Id = idd);
            objCase.Auto_Close_Reopen__c = false; 
            lstUpdateCase.add(objCase);   
        }
        update lstUpdateCase;  
    }
}
Hi Friends,

I want to make trigger on Lead that whenevr my Lead is created Account should also create. And after the creation of Account I want that same account should map in account__c field of my lead.

I created trigger on this but that I created for before insert case. Now I want same thing to happen in After insert case, bcoz the trigger is failing by validation rule in before case.

Can anyone help me on this..
Trigger which I wrote..
trigger BaseLineTrigger on Lead (before insert, after insert,before update,after update) {
   
       LeadHandler objLead = new LeadHandler();
       
    if(Trigger.isBefore && Trigger.isInsert) {
        objLead.addAccount(Trigger.New); 
     }
}

Handler Class :-

public class LeadHandler {
    
    public LeadHandler(){}

    public void addAccount(list<Lead> lstLead) {
        map<Integer,Account> mapAccount = new map<Integer,Account>();
        integer i =0;
       
            for(Lead objLead : lstLead) {
                Account objAccount = new Account();                     
                if(objLead.status =='Base Line' && objLead.Origin__c != 'Mobile'){
                    system.debug('================'+objLead);
                        mapUserBaseNo.put(objLead.OwnerId, mapUserBaseNo.get(objLead.OwnerId)+1);
                    if(objLead.FirstName!= null)
                        objAccount.Name = objLead.FirstName + ' ' + objLead.LastName;
                    else
                       objAccount.Name = objLead.LastName;
                       objAccount.Contact_Number__c = objLead.Phone;
                    objAccount.Date_of_Birth__c  = objLead.Date_Of_Birth__c;
                    objAccount.BillingCity = objLead.City;  
                    objAccount.BillingCountry =objLead.Country;
                    objAccount.BillingStreet = objLead.Street;
                    objAccount.BillingState = objLead.State;
                    objAccount.BillingStateCode = objLead.StateCode;
                    objAccount.BillingPostalCode = objLead.PostalCode;
                    objAccount.Disability__c = objLead.Disability__c;
                    objAccount.Profile_Pictures__c = objLead.Image__c;
                    objAccount.Parent_Guardian_name__c = objLead.Company;
                    objAccount.Village__c = objLead.Village__c;
                    mapAccount.put(i,objAccount);
                }
                 i++; 
            }
        
        insert mapAccount.values();          
        
        integer j =0;
            for(Lead objLead : lstLead){
                if(mapAccount.containsKey(j))
                    objLead.Account__c = mapAccount.get(j).id;
                    j++;
             }
    }
Hi all,

My component code:-
<aura:set attribute="auraPreInitBlock">
    <auraStorage:init debugLoggingEnabled="true"
                         name="actions"
                         persistent="false" secure="true"
                         clearStorageOnInit="true"
                         defaultExpiration="3600"
                         maxSize="10485760" version="1.0"/>
    </aura:set> 

On the client side controller :-
doInit:function(cmp, evt, helper){
// Get server-side action
var action = cmp.get("c.fetchDataRecord");
action.setCallback(cmp, function(response){
var returnValue = response.getReturnValue();
});
// Set server-side action as storable
action.setStorable();
// Run server-side action
$A.enqueueAction(action);
},

I played with  all attribute maxsize, defaultExpiration but nothing is working out.
If anybody has came across same senario please help.

Many thanks in Advance!!
Hi all,

 - I want to acheive something by using $('.ClassName') in JS controller it is looking like impossible to do that by component.find('aura:id');
 - I am using <ltng:require scripts="{!$Resource.MyNameSpace__MyResourceName}"  /> as per lightning guide to add external source library.
 - I found one blog as well there we have unmanaged package and we can use external libraries below is the link
https://login.salesforce.com/packaging/installPackage.apexp?p0=04tB000000011BS 
But I cannot able to install this package as well..some error is coming..

Anybody has any idea how to overcome this error below is the screenshot for the same
User-added image
Hi All,

I want to hide aura:iteration indexing of same name..here is my code
<aura:iteration items="{!v.payStmtList}" var="paySt" indexVar="index">
            <tr>
                <td> <ui:outputText value="{!paySt.Name}" /></td>
                <td>{!index}</td>
                <td></td>
            </tr>
            <br/>
            <tr>
                <aura:iteration items="{!v.fieldNames}" var="fieldName">
                    <td>
                        <c:PayStatementItem paySt="{!paySt}" fieldName="{!fieldName}"/>
                    </td>
                </aura:iteration>
            </tr>
        </aura:iteration>
I am attaching the file of output.
User-added image
I want to achieve something like when one Month Name is coming in the first iteration "<td> <ui:outputText value="{!paySt.Name}" /></td>".. here december december and november november is coming two/three times I want these values to be once. Anybody has any idea
Hey there!

Can we use eclipse IDE for lightning development?
When I tried, don't see any technologies related to lightning like component, controllers, renderer etc.

We also use SVN for version tracking and finding hard time in new project which requires lightning framework completely.

Thanks in advance for y.ur response
Hi All

I have a query here, like you are on Account detail page, there are some related list(Contact, opportunity...). If we create a record in any related list(here i created contact) and save. So in Contact related list in Account detail page, when i click on Edit action link(marked as RED in snapshot), it will redirect to contact record in edit mode, but I want to open in same(Edit mode) on Account detail page.

User-added image

Please suggest what is the way to do this.

Thanks,
Manav
Hi,

There is a custom checkbox field Auto_Close_Reopen__c for case object. For after update event if the Auto_Close_Reopen__c checkbox checked I want to create new case and want to update Auto_Close_Reopen__c checkbox field value to false. We can achieve it by before update case but I want it to make for after update event. I wrote a trigger for it. but I am getting this error message

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger CaseTrigger caused an unexpected exception, contact your administrator: CaseTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 5009000000mId8xAAC; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CaseTrigger: maximum trigger depth exceeded Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x] Case trigger event AfterUpdate for [5009000000mId8x]: []: Class.CaseHandler.AfterUpdateCase: line 26, column 1

The code of my trigger is 
trigger CaseTrigger on Case (after update) {
    CaseHandler objCase = new CaseHandler();
    
    if(Trigger.isAfter && Trigger.isUpdate){
        objCase.AfterUpdateCase(Trigger.New);
    }
}

Code for Handler class of trigger

public with sharing class CaseHandler {
    list<Case> lstCloneCase = new list<Case>();
    map<Id,Case> mapCase = new map<Id,Case>();
    list<Case> lstUpdateCase = new list<Case>();
    
    public void AfterUpdateCase(list<Case> lstCase){
        for(Case objCase : lstCase){
            mapCase.put(objCase.Id,objCase);
            
            if(objCase.Auto_Close_Reopen__c == true){
                Case objCaseNew = new Case();
                objCaseNew.Status = 'Open';
                ObjCaseNew.Origin = 'Web';
                lstCloneCase.add(ObjCaseNew);
            }
        }
        insert lstCloneCase;
        
        for(Id idd : mapCase.keyset()){
            Case objCase = new Case(Id = idd);
            objCase.Auto_Close_Reopen__c = false; 
            lstUpdateCase.add(objCase);   
        }
        update lstUpdateCase;  
    }
}
Hi Friends,

I want to make trigger on Lead that whenevr my Lead is created Account should also create. And after the creation of Account I want that same account should map in account__c field of my lead.

I created trigger on this but that I created for before insert case. Now I want same thing to happen in After insert case, bcoz the trigger is failing by validation rule in before case.

Can anyone help me on this..
Trigger which I wrote..
trigger BaseLineTrigger on Lead (before insert, after insert,before update,after update) {
   
       LeadHandler objLead = new LeadHandler();
       
    if(Trigger.isBefore && Trigger.isInsert) {
        objLead.addAccount(Trigger.New); 
     }
}

Handler Class :-

public class LeadHandler {
    
    public LeadHandler(){}

    public void addAccount(list<Lead> lstLead) {
        map<Integer,Account> mapAccount = new map<Integer,Account>();
        integer i =0;
       
            for(Lead objLead : lstLead) {
                Account objAccount = new Account();                     
                if(objLead.status =='Base Line' && objLead.Origin__c != 'Mobile'){
                    system.debug('================'+objLead);
                        mapUserBaseNo.put(objLead.OwnerId, mapUserBaseNo.get(objLead.OwnerId)+1);
                    if(objLead.FirstName!= null)
                        objAccount.Name = objLead.FirstName + ' ' + objLead.LastName;
                    else
                       objAccount.Name = objLead.LastName;
                       objAccount.Contact_Number__c = objLead.Phone;
                    objAccount.Date_of_Birth__c  = objLead.Date_Of_Birth__c;
                    objAccount.BillingCity = objLead.City;  
                    objAccount.BillingCountry =objLead.Country;
                    objAccount.BillingStreet = objLead.Street;
                    objAccount.BillingState = objLead.State;
                    objAccount.BillingStateCode = objLead.StateCode;
                    objAccount.BillingPostalCode = objLead.PostalCode;
                    objAccount.Disability__c = objLead.Disability__c;
                    objAccount.Profile_Pictures__c = objLead.Image__c;
                    objAccount.Parent_Guardian_name__c = objLead.Company;
                    objAccount.Village__c = objLead.Village__c;
                    mapAccount.put(i,objAccount);
                }
                 i++; 
            }
        
        insert mapAccount.values();          
        
        integer j =0;
            for(Lead objLead : lstLead){
                if(mapAccount.containsKey(j))
                    objLead.Account__c = mapAccount.get(j).id;
                    j++;
             }
    }