• abu saleh khan 8
  • NEWBIE
  • 60 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 8
    Replies
Hi Team,

I want to embed sharepoint login page in a lightning component. I can embed few websites but i want to get sharepoint login page to the component.User-added image


<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <iframe src="https://wrgrace.sharepoint.com/sites/dev-MXTest14"
            width="100%"
            height="500px"
            sandbox="allow-same-origin allow-scripts allow-forms"
            scrolling="auto"/>
</aura:component>

<aura:application extends="force:slds">
    <c:WebPageEmbed/>
</aura:application>
Self signed certificate is about to expire and my org is enabled with sso, on the other end microsoft azure is integrated with salesforce. How to renew self signed certificate. After renewal do i have to update this certificate in microsoft active directory?
Hi Team,

My requirement is, i have a add row component which is added to my Account record detail page. I am trying to bulk insert the records in contact as a related contact to the account. I want to fetch accountid in the column, inorder to insert into contact. Kindly look at the snippet.

AddRowEvent:

<aura:event type="COMPONENT" description="Use For Add New Row"></aura:event> 

DeleteRowEvent:

<aura:event type="COMPONENT" description="Event to remove Row" >
    <aura:attribute name="indexVar" type="Integer" description="Use For Delete Row" />
</aura:event>

User-added image

<aura:component controller="AddDeleteController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,lightning:isUrlAddressable">
  <!--Init handler which is call doInit js function on component Load-->  
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  
 <!--Event handler for Add and Delete Row Event which is fire from Child Component-->    
    <aura:handler name="DeleteRowEvent" event="c:DeleteRowEvt" action="{!c.removeDeletedRow}"/>
    <aura:handler name="AddRowEvt" event="c:AddRowEvent" action="{!c.addNewRow}"/>
 
 <!--Aura Attribute for store Contact Object List as Array-->    
    <aura:attribute name="contactList" type="Contact[]"/>      
 <!--Table Part-->           
    <table class="slds-table slds-table_bordered slds-table_cell-buffer"> 
        <thead>
            <tr class="slds-text-title_caps">
                <th scope="col">
                    <div class="slds-truncate">Sno</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Price Record Id">Price Record Id</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Product">Product</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="SAP Id">SAP Id</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Proposed Price">Proposed Price</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="UOM">UOM</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Validity Start">Validity Start</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Validity End">Validity End</div>
                </th>
            </tr>
        </thead>   
        <tbody>
           <!--Iterate the child Component for display Table rows 
               with pass the List Item Index for track the Every child Component 
               and pass each List Contact Instance -->         
            <aura:iteration items="{!v.contactList}" var="item" indexVar="index">
                <c:DynamicRowItem ContactInstance="{!item}" rowIndex="{!index}" />
            </aura:iteration>
        </tbody>
    </table>
    <br/>
    <!--Save Button which is call Save js function on click --> 
    <button class="slds-button slds-button_brand" onclick="{!c.Save}">Save</button>
</aura:component>

DynamicRowController:

({
 
    // function call on component Load
    doInit: function(component, event, helper) {
        // create a Default RowItem [Contact Instance] on first time Component Load
        // by call this helper function  
        helper.createObjectData(component, event);
    },
 
    // function for save the Records 
    Save: function(component, event, helper) {
        // first call the helper function in if block which will return true or false.
        // this helper function check the "first Name" will not be blank on each row.
        if (helper.validateRequired(component, event)) {
            // call the apex class method for save the Contact List
            // with pass the contact List attribute to method param.  
            var action = component.get("c.saveContacts");
            action.setParams({
                "ListContact": component.get("v.contactList")
            });
            // set call back 
            action.setCallback(this, function(response) {
                var state = response.getState();
                if (state === "SUCCESS") {
                    // if response if success then reset/blank the 'contactList' Attribute 
                    // and call the common helper method for create a default Object Data to Contact List 
                    component.set("v.contactList", []);
                    helper.createObjectData(component, event);
                    alert('record Save');
                }
            });
            // enqueue the server side action  
            $A.enqueueAction(action);
        }
    },
 
    // function for create new object Row in Contact List 
    addNewRow: function(component, event, helper) {
        // call the comman "createObjectData" helper method for add new Object Row to List  
        helper.createObjectData(component, event);
    },
 
    // function for delete the row 
    removeDeletedRow: function(component, event, helper) {
        // get the selected row Index for delete, from Lightning Event Attribute  
        var index = event.getParam("indexVar");
        // get the all List (contactList attribute) and remove the Object Element Using splice method    
        var AllRowsList = component.get("v.contactList");
        AllRowsList.splice(index, 1);
        // set the contactList after remove selected row element  
        component.set("v.contactList", AllRowsList);
    },
})

DynamicRowHelper.js

({
    createObjectData: function(component, event) {
        // get the contactList from component and add(push) New Object to List  
        var RowItemList = component.get("v.contactList");
        RowItemList.push({
            'sobjectType': 'Contact',
            'FirstName': '',
            'LastName': '',
            'Phone': ''
        });
        // set the updated list to attribute (contactList) again    
        component.set("v.contactList", RowItemList);
    },
    // helper function for check if first Name is not null/blank on save  
    validateRequired: function(component, event) {
        var isValid = true;
        var allContactRows = component.get("v.contactList");
        for (var indexVar = 0; indexVar < allContactRows.length; indexVar++) {
            if (allContactRows[indexVar].FirstName == '') {
                isValid = false;
                alert('First Name Can\'t be Blank on Row Number ' + (indexVar + 1));
            }
        }
        return isValid;
    },
})

DynamicRowItem:

<aura:component >    
    <!-- Aura Attribute for store single Contact[standard Object] Instance
         And Store Index of Particular Instance --> 
    <aura:attribute name="ContactInstance" type="Contact"/>
    <aura:attribute name="rowIndex" type="String"/>
    
    <!-- Register 2 Lightning Event for handle add or Delete rows on Parent Component  --> 
    <aura:registerEvent name="DeleteRowEvent" type="c:DeleteRowEvt"/> 
    <aura:registerEvent name="AddRowEvt" type="c:AddRowEvent"/> 
    
    <!-- Table Row -->   
    <tr class="slds-text-title_caps">
        <td> 
            {!v.rowIndex + 1}
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.FirstName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.LastName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.Phone}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.FirstName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.LastName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.Phone}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.FirstName}"/>
        </td>
        <td>
            <!-- conditionally Display Add or Delete Icons
                 if rowIndex is 0 then show Add New Row Icon else show delete Icon
             --> 
            <aura:if isTrue="{!v.rowIndex == 0}">
                <a onclick="{!c.AddNewRow}">
                  <lightning:icon iconName="utility:add" class="slds-icon slds-icon_small" size="small" alternativeText="add"/>
                  <span class="slds-assistive-text">Add Icon</span>
                </a>    
              <aura:set attribute="else">
                  <a onclick="{!c.removeRow}">
                   <lightning:icon variant="error" iconName="utility:delete" class="slds-icon slds-icon_small" size="small" alternativeText="icon"/>
                   <span class="slds-assistive-text">Delete Icon</span>
                  </a>
              </aura:set> 
            </aura:if>
        </td> 
    </tr>
</aura:component>

DynamicRowItemController.js

({
    AddNewRow : function(component, event, helper){
       // fire the AddNewRowEvt Lightning Event 
        component.getEvent("AddRowEvt").fire();     
    },
    
    removeRow : function(component, event, helper){
     // fire the DeleteRowEvt Lightning Event and pass the deleted Row Index to Event parameter/attribute
       component.getEvent("DeleteRowEvent").setParams({"indexVar" : component.get("v.rowIndex") }).fire();
    }, 
  
})
Hi Team,

Kindly help me navigating from one component to another component using lightning:navigation.
Hi all,

I have a requirement to create a lightning component in which I need a modal box with checkbox, which should stop showing up when user select a checkbox.

I have referred many Javascript examples but unfortunately I am not able to figure it out.

Thanks.
 
Hi all,

I have a requirement in which I need to show parent field in lightning:datatable column. I'm trying to display Account Name in Contact datable, but it seems parent fields are not supported in lightning datatable. 

I am able to show Contact details in a table but the problem occurs when I get data from a parent record. I want the Account name of my contact.

Is there any way to show parent record data with this component?

Thanks.
 
I am getting this Exception When I am trying to push values into a Map.Kindly help me out.


Vf:
<apex:page Controller="OM_OrderManagementEncap">
  <apex:form >
    <apex:pageBlock Title="Account Details">
      <apex:pageBlockSection title="Account Details">
        <apex:outputLabel value="Account Name: "/>
          <apex:selectList value="{!selectedObject}" size="1">
            <apex:actionSupport action="{!selectAccount}" event="onchange" reRender="rfrsh"/>
            <apex:selectOptions value="{!objectNames}"/>
          </apex:selectList>
      </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:pageBlock mode="inlineEdit" id="rfrsh" >
      <apex:pageBlockSection title="Related Records">
        <apex:pageblockTable value="{!objFields}" var="c">
            <apex:column value="{!objFields[c].act.Name}"/>
            <apex:column value="{!objFields[c].od.OrderNumber}"/>
            <apex:column value="{!objFields[c].od.Status}"/>
            <apex:column value="{!objFields[c].od.EffectiveDate}"/>
            <apex:column value="{!objFields[c].ct.ContractNumber}"/>
            <apex:column value="{!objFields[c].ct.Status}"/>
            <apex:column value="{!objFields[c].ct.ContractTerm}"/>
        </apex:pageblockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

Controller:

public with sharing class OM_OrderManagementEncap {

    public List<SelectOption> objectNames { get; set; }
    
    public Map<id,Wrapperr> objFields { get; set; }
    
    public String selectedObject { get; set; }

    
    public OM_OrderManagementEncap(){
        objFields = new Map<id,Wrapperr>();
        objectNames = new List<SelectOption>();
        objectNames.add(new SelectOption('none','<choose one>')); 
        List<Account> aclst = [SELECT id,name FROM Account Order By CreatedDate desc LIMIT 2];
        for(Account acc : aclst){
        objectNames.add(new SelectOption(acc.id,acc.name));
        }
    }
    public PageReference selectAccount() {
        List<Account> actlst = [SELECT Id,Name,(SELECT id,OrderNumber,Status,EffectiveDate FROM ORDERS),(SELECT id,ContractNumber,Status,ContractTerm FROM Contracts) FROM Account WHERE Id = :selectedObject];
        System.debug(''+actlst);
        for(Account att : actlst){
        System.debug('Selected account is: '+att);
            try{
        objFields.put(att.id,new Wrapperr(att,att.Contracts,att.Orders));
                }
            catch(Exception e){
                System.debug(''+e);
            }
        
    }
    return null;
}

    Public Class Wrapperr{
        public Account act { get; set; }
        Public Contract ct { get; set; }
        Public Order od { get; set; }
        
        public Wrapperr(Account act,Contract ct,Order od){
            this.act = act;
            this.ct = ct;
            this.od = od;
            
    
    }
    
    
}
}
Here is my code for password reset.

Component

<aura:component Controller="PasswordReset">
    <aura:attribute name="passstore" type="String"/>
    <lightning:input label="Enter New Password: " value="{!v.passstore}"/>
    <lightning:button label="Reset" onclick="{!c.change}"/>
</aura:component>


Client-Controller

({
    change : function(component, event, helper) {
    
        var clntvar = component.get("v.passstore");
        console.log('I am in first var: '+ clntvar);
        var srvrvar = component.get("c.resetmthd");
        console.log('m in second var: '+srvrvar);
        srvrvar.setParams({srvrparmtr : clntvar});
        
        console.log('Hi, I am srvr parameter '+ srvrvar);
        srvrvar.setCallback(this,function(response){
            
            var state = response.getState()
            console.log('m in callback: '+state)
            if(state === "SUCCESS"){
                
                alert("Email sent to mentioned emailid: " + response.getReturnValue);
    }
                          else if (state === "INCOMPLETE") {
                alert("I am in incomplete");
                // do something
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
                     }
            
        });
        $A.enqueueAction(srvrvar);
    }   
})

server-controller

public class PasswordReset {
    
    @AuraEnabled
    public static void resetmthd(String srvrparmtr){        
        List<Employee__c> emplst = new List<Employee__c>();
        Employee__c empp = new Employee__c();
        System.debug('hi m server method parameter: '+ ApexPages.currentPage().getParameters().get('id'));
        empp = [SELECT id,Password__c FROM Employee__c WHERE id = :ApexPages.currentPage().getParameters().get('id')];        
        empp.password__c = srvrparmtr;
        emplst.add(empp);        
        try{
        update emplst;
         }
        Catch(Exception e){
           System.debug('M in server controller '+ emplst);
           System.debug('hi m server method parameter: '+ ApexPages.currentPage().getParameters().get('id'));   
        }   
    }
}
Hi, I have a use case.I have three objects Student,Account and Contact."Student is parent to Account and Account is  parent to Contact.When ever i update Tenure field in contact,Students "Tenure" field should also be updated.I am having issues wth code.When I am tring to update a field in contact this isthe error, I am getting.<<< ERROR :    Review the following errors
StudentTenure: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Trigger.StudentTenure: line 14, column 1 :>>>

Program:

trigger StudentTenure on Contact (After Update) {
    List<Student__c> stulst = new List<Student__c>();
    List<Contact> cst = new List<Contact>();
    cst = [SELECT id,Name,Tenure__c,Account.Student__r.Tenure__c FROM Contact WHERE id IN :Trigger.old];
    System.debug('Data is cst: '+cst);
    for(Contact c : cst){
    
        Student__c s = new Student__c();
        if(c.Tenure__c == 'OLD'){
            s.Tenure__c = 'OLD';
        }
        stulst.add(s);
    }
    update stulst;
}

 
Vf Page:

<apex:page StandardController="Opportunity" extensions="PopupOnOpportunity">
  <apex:form>
     
    <apex:outputPanel id="tstpopup">
    <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
    <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
                Can't create opportuinity from here. Please click OK to create opportunity.<br/><br/><br/>
      <apex:commandButton value="OK" action="{!clickok}" />
   </apex:outputPanel>
    </apex:outputPanel>
  </apex:form>
   <style type="text/css">
        .custPopup{
            background-color: white;
            border-width: 2px;
            border-style: solid;
            z-index: 9999;
            left: 50%;
            padding:10px;
            position: absolute;
            /* These are the 3 css properties you will need to change so the popup 
            displays in the center of the screen. First set the width. Then set 
            margin-left to negative half of what the width is. You can add 
            the height property for a fixed size pop up if you want.*/
            width: 500px;
            margin-left: -250px;
            top:100px;
        }
        .popupBackground{
            background-color:black;
            opacity: 0.20;
            filter: alpha(opacity = 20);
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 9998;
        }

    </style>
</apex:page>


Apex:
public class PopupOnOpportunity {
    public boolean displayPopup {get; set;}
    public static Integer count = 0;
    public PopupOnOpportunity(ApexPages.StandardController controller){
        //Opportunity op = new Opportunity();
        if(count == 0){ 
            displayPopup = true;
        }else{
            displayPopup = false;
        }
    }
    public Pagereference clickok(){
        count++;
        Pagereference pr = new Pagereference('/003/o?nooverride=1');
        
        pr.setRedirect(true);
        System.debug('Count is: ' +count);
        return pr;
    }
}
I have a use case,Where a youtube link is hard-coded,i want to fetch title of the link give above without using integrations..
Vf 

<apex:page Controller="Task39PhoneValidation">
  <apex:sectionHeader title="Student" subtitle="Home"/>
  <apex:pagemessages />
  <apex:form >
    <apex:pageblock tabstyle="Student__c">
      <apex:pageblockbuttons >
        <apex:commandButton value="Save" action="{!submit}"/>
        <apex:commandButton value="Save&New" action="{!saveandnew}"/>
        <apex:commandButton value="Cancel" action="{!cmeback}"/>
      </apex:pageblockbuttons>
      <apex:pageBlockSection >
        
      <apex:pageBlockSection title="Student Details" >
        <apex:inputField value="{!st.Name}"/>
        <apex:inputField value="{!st.Last_Name__c}"/>
        <apex:inputField value="{!st.Dob__c}"/>
      </apex:pageBlockSection>
      <apex:PageBlockSection title="Additional Details">
        <apex:inputField value="{!st.Tenure__c}"/>
        <apex:inputField value="{!st.Course__c}"/>
        <apex:inputField value="{!st.Doctor__c}"/>
      </apex:PageBlockSection>
      <apex:pageBlockSection title="Contact Details">
        <apex:inputField value="{!st.Address__c}"/>
        <apex:inputField value="{!st.Permanent_Address__c}"/>
        <apex:inputField value="{!st.Mobile__c}"/>
      </apex:pageBlockSection>
      </apex:pageBlockSection>
    </apex:pageblock>
  </apex:form>
</apex:page>




Controller:

public with sharing class Task39PhoneValidation {
    
    Public Integer phn;
    
    public Task39PhoneValidation(){
        st = new Student__c();
        
    }

    public PageReference cmeback() {
        return null;
    }


    public PageReference saveandnew() {
        return null;
    }


    public PageReference submit() {
        phn = st.mobile__c.length();
        if(phn == 10 ){
            insert st;
        }
        else{
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Your Phone number should have Only 10 digits not more than that or lesser then that .'));
        }
        
        return null;
    }


    public Student__c st { get; set; }
}
Hi Team,

My requirement is, i have a add row component which is added to my Account record detail page. I am trying to bulk insert the records in contact as a related contact to the account. I want to fetch accountid in the column, inorder to insert into contact. Kindly look at the snippet.

AddRowEvent:

<aura:event type="COMPONENT" description="Use For Add New Row"></aura:event> 

DeleteRowEvent:

<aura:event type="COMPONENT" description="Event to remove Row" >
    <aura:attribute name="indexVar" type="Integer" description="Use For Delete Row" />
</aura:event>

User-added image

<aura:component controller="AddDeleteController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,lightning:isUrlAddressable">
  <!--Init handler which is call doInit js function on component Load-->  
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  
 <!--Event handler for Add and Delete Row Event which is fire from Child Component-->    
    <aura:handler name="DeleteRowEvent" event="c:DeleteRowEvt" action="{!c.removeDeletedRow}"/>
    <aura:handler name="AddRowEvt" event="c:AddRowEvent" action="{!c.addNewRow}"/>
 
 <!--Aura Attribute for store Contact Object List as Array-->    
    <aura:attribute name="contactList" type="Contact[]"/>      
 <!--Table Part-->           
    <table class="slds-table slds-table_bordered slds-table_cell-buffer"> 
        <thead>
            <tr class="slds-text-title_caps">
                <th scope="col">
                    <div class="slds-truncate">Sno</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Price Record Id">Price Record Id</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Product">Product</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="SAP Id">SAP Id</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Proposed Price">Proposed Price</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="UOM">UOM</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Validity Start">Validity Start</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Validity End">Validity End</div>
                </th>
            </tr>
        </thead>   
        <tbody>
           <!--Iterate the child Component for display Table rows 
               with pass the List Item Index for track the Every child Component 
               and pass each List Contact Instance -->         
            <aura:iteration items="{!v.contactList}" var="item" indexVar="index">
                <c:DynamicRowItem ContactInstance="{!item}" rowIndex="{!index}" />
            </aura:iteration>
        </tbody>
    </table>
    <br/>
    <!--Save Button which is call Save js function on click --> 
    <button class="slds-button slds-button_brand" onclick="{!c.Save}">Save</button>
</aura:component>

DynamicRowController:

({
 
    // function call on component Load
    doInit: function(component, event, helper) {
        // create a Default RowItem [Contact Instance] on first time Component Load
        // by call this helper function  
        helper.createObjectData(component, event);
    },
 
    // function for save the Records 
    Save: function(component, event, helper) {
        // first call the helper function in if block which will return true or false.
        // this helper function check the "first Name" will not be blank on each row.
        if (helper.validateRequired(component, event)) {
            // call the apex class method for save the Contact List
            // with pass the contact List attribute to method param.  
            var action = component.get("c.saveContacts");
            action.setParams({
                "ListContact": component.get("v.contactList")
            });
            // set call back 
            action.setCallback(this, function(response) {
                var state = response.getState();
                if (state === "SUCCESS") {
                    // if response if success then reset/blank the 'contactList' Attribute 
                    // and call the common helper method for create a default Object Data to Contact List 
                    component.set("v.contactList", []);
                    helper.createObjectData(component, event);
                    alert('record Save');
                }
            });
            // enqueue the server side action  
            $A.enqueueAction(action);
        }
    },
 
    // function for create new object Row in Contact List 
    addNewRow: function(component, event, helper) {
        // call the comman "createObjectData" helper method for add new Object Row to List  
        helper.createObjectData(component, event);
    },
 
    // function for delete the row 
    removeDeletedRow: function(component, event, helper) {
        // get the selected row Index for delete, from Lightning Event Attribute  
        var index = event.getParam("indexVar");
        // get the all List (contactList attribute) and remove the Object Element Using splice method    
        var AllRowsList = component.get("v.contactList");
        AllRowsList.splice(index, 1);
        // set the contactList after remove selected row element  
        component.set("v.contactList", AllRowsList);
    },
})

DynamicRowHelper.js

({
    createObjectData: function(component, event) {
        // get the contactList from component and add(push) New Object to List  
        var RowItemList = component.get("v.contactList");
        RowItemList.push({
            'sobjectType': 'Contact',
            'FirstName': '',
            'LastName': '',
            'Phone': ''
        });
        // set the updated list to attribute (contactList) again    
        component.set("v.contactList", RowItemList);
    },
    // helper function for check if first Name is not null/blank on save  
    validateRequired: function(component, event) {
        var isValid = true;
        var allContactRows = component.get("v.contactList");
        for (var indexVar = 0; indexVar < allContactRows.length; indexVar++) {
            if (allContactRows[indexVar].FirstName == '') {
                isValid = false;
                alert('First Name Can\'t be Blank on Row Number ' + (indexVar + 1));
            }
        }
        return isValid;
    },
})

DynamicRowItem:

<aura:component >    
    <!-- Aura Attribute for store single Contact[standard Object] Instance
         And Store Index of Particular Instance --> 
    <aura:attribute name="ContactInstance" type="Contact"/>
    <aura:attribute name="rowIndex" type="String"/>
    
    <!-- Register 2 Lightning Event for handle add or Delete rows on Parent Component  --> 
    <aura:registerEvent name="DeleteRowEvent" type="c:DeleteRowEvt"/> 
    <aura:registerEvent name="AddRowEvt" type="c:AddRowEvent"/> 
    
    <!-- Table Row -->   
    <tr class="slds-text-title_caps">
        <td> 
            {!v.rowIndex + 1}
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.FirstName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.LastName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.Phone}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.FirstName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.LastName}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.Phone}"/>
        </td>
        <td>
            <lightning:input class="slds-input" value="{!v.ContactInstance.FirstName}"/>
        </td>
        <td>
            <!-- conditionally Display Add or Delete Icons
                 if rowIndex is 0 then show Add New Row Icon else show delete Icon
             --> 
            <aura:if isTrue="{!v.rowIndex == 0}">
                <a onclick="{!c.AddNewRow}">
                  <lightning:icon iconName="utility:add" class="slds-icon slds-icon_small" size="small" alternativeText="add"/>
                  <span class="slds-assistive-text">Add Icon</span>
                </a>    
              <aura:set attribute="else">
                  <a onclick="{!c.removeRow}">
                   <lightning:icon variant="error" iconName="utility:delete" class="slds-icon slds-icon_small" size="small" alternativeText="icon"/>
                   <span class="slds-assistive-text">Delete Icon</span>
                  </a>
              </aura:set> 
            </aura:if>
        </td> 
    </tr>
</aura:component>

DynamicRowItemController.js

({
    AddNewRow : function(component, event, helper){
       // fire the AddNewRowEvt Lightning Event 
        component.getEvent("AddRowEvt").fire();     
    },
    
    removeRow : function(component, event, helper){
     // fire the DeleteRowEvt Lightning Event and pass the deleted Row Index to Event parameter/attribute
       component.getEvent("DeleteRowEvent").setParams({"indexVar" : component.get("v.rowIndex") }).fire();
    }, 
  
})
Hi Team,

Kindly help me navigating from one component to another component using lightning:navigation.
I am getting this Exception When I am trying to push values into a Map.Kindly help me out.


Vf:
<apex:page Controller="OM_OrderManagementEncap">
  <apex:form >
    <apex:pageBlock Title="Account Details">
      <apex:pageBlockSection title="Account Details">
        <apex:outputLabel value="Account Name: "/>
          <apex:selectList value="{!selectedObject}" size="1">
            <apex:actionSupport action="{!selectAccount}" event="onchange" reRender="rfrsh"/>
            <apex:selectOptions value="{!objectNames}"/>
          </apex:selectList>
      </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:pageBlock mode="inlineEdit" id="rfrsh" >
      <apex:pageBlockSection title="Related Records">
        <apex:pageblockTable value="{!objFields}" var="c">
            <apex:column value="{!objFields[c].act.Name}"/>
            <apex:column value="{!objFields[c].od.OrderNumber}"/>
            <apex:column value="{!objFields[c].od.Status}"/>
            <apex:column value="{!objFields[c].od.EffectiveDate}"/>
            <apex:column value="{!objFields[c].ct.ContractNumber}"/>
            <apex:column value="{!objFields[c].ct.Status}"/>
            <apex:column value="{!objFields[c].ct.ContractTerm}"/>
        </apex:pageblockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

Controller:

public with sharing class OM_OrderManagementEncap {

    public List<SelectOption> objectNames { get; set; }
    
    public Map<id,Wrapperr> objFields { get; set; }
    
    public String selectedObject { get; set; }

    
    public OM_OrderManagementEncap(){
        objFields = new Map<id,Wrapperr>();
        objectNames = new List<SelectOption>();
        objectNames.add(new SelectOption('none','<choose one>')); 
        List<Account> aclst = [SELECT id,name FROM Account Order By CreatedDate desc LIMIT 2];
        for(Account acc : aclst){
        objectNames.add(new SelectOption(acc.id,acc.name));
        }
    }
    public PageReference selectAccount() {
        List<Account> actlst = [SELECT Id,Name,(SELECT id,OrderNumber,Status,EffectiveDate FROM ORDERS),(SELECT id,ContractNumber,Status,ContractTerm FROM Contracts) FROM Account WHERE Id = :selectedObject];
        System.debug(''+actlst);
        for(Account att : actlst){
        System.debug('Selected account is: '+att);
            try{
        objFields.put(att.id,new Wrapperr(att,att.Contracts,att.Orders));
                }
            catch(Exception e){
                System.debug(''+e);
            }
        
    }
    return null;
}

    Public Class Wrapperr{
        public Account act { get; set; }
        Public Contract ct { get; set; }
        Public Order od { get; set; }
        
        public Wrapperr(Account act,Contract ct,Order od){
            this.act = act;
            this.ct = ct;
            this.od = od;
            
    
    }
    
    
}
}
Here is my code for password reset.

Component

<aura:component Controller="PasswordReset">
    <aura:attribute name="passstore" type="String"/>
    <lightning:input label="Enter New Password: " value="{!v.passstore}"/>
    <lightning:button label="Reset" onclick="{!c.change}"/>
</aura:component>


Client-Controller

({
    change : function(component, event, helper) {
    
        var clntvar = component.get("v.passstore");
        console.log('I am in first var: '+ clntvar);
        var srvrvar = component.get("c.resetmthd");
        console.log('m in second var: '+srvrvar);
        srvrvar.setParams({srvrparmtr : clntvar});
        
        console.log('Hi, I am srvr parameter '+ srvrvar);
        srvrvar.setCallback(this,function(response){
            
            var state = response.getState()
            console.log('m in callback: '+state)
            if(state === "SUCCESS"){
                
                alert("Email sent to mentioned emailid: " + response.getReturnValue);
    }
                          else if (state === "INCOMPLETE") {
                alert("I am in incomplete");
                // do something
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
                     }
            
        });
        $A.enqueueAction(srvrvar);
    }   
})

server-controller

public class PasswordReset {
    
    @AuraEnabled
    public static void resetmthd(String srvrparmtr){        
        List<Employee__c> emplst = new List<Employee__c>();
        Employee__c empp = new Employee__c();
        System.debug('hi m server method parameter: '+ ApexPages.currentPage().getParameters().get('id'));
        empp = [SELECT id,Password__c FROM Employee__c WHERE id = :ApexPages.currentPage().getParameters().get('id')];        
        empp.password__c = srvrparmtr;
        emplst.add(empp);        
        try{
        update emplst;
         }
        Catch(Exception e){
           System.debug('M in server controller '+ emplst);
           System.debug('hi m server method parameter: '+ ApexPages.currentPage().getParameters().get('id'));   
        }   
    }
}
Hi, I have a use case.I have three objects Student,Account and Contact."Student is parent to Account and Account is  parent to Contact.When ever i update Tenure field in contact,Students "Tenure" field should also be updated.I am having issues wth code.When I am tring to update a field in contact this isthe error, I am getting.<<< ERROR :    Review the following errors
StudentTenure: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Trigger.StudentTenure: line 14, column 1 :>>>

Program:

trigger StudentTenure on Contact (After Update) {
    List<Student__c> stulst = new List<Student__c>();
    List<Contact> cst = new List<Contact>();
    cst = [SELECT id,Name,Tenure__c,Account.Student__r.Tenure__c FROM Contact WHERE id IN :Trigger.old];
    System.debug('Data is cst: '+cst);
    for(Contact c : cst){
    
        Student__c s = new Student__c();
        if(c.Tenure__c == 'OLD'){
            s.Tenure__c = 'OLD';
        }
        stulst.add(s);
    }
    update stulst;
}