• Devadarsi Devasis 2
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 1
    Replies
productList = new map<Id,Product2>([select Id,ProductCode,Name,Brand__c,Stock_Quantity__c 
 from Product2 where Brand__c LIKE :'%'+searchValue+'%' AND Stock_Quantity__c>0]);
I want to copy the value of a field of a standard object and put the same value in the field of a custom object
Can anyone help me in this?
Order Remarks filed is mandatary if the order stage is Cancelled else system should display the error message “Order Remarks filed is mandatary, Please enter the remarks”.
Here stage is a picklist having a value "Cancelled"?
CustomListView.cmp

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
                access="global"
                controller="listViewController">
 <!-- call doInit js function on component load to fetch list view details-->   
    <aura:handler name="init" value="this" action="{!c.doInit}"/>
 <!-- aura attributes -->   
    <aura:attribute name="listViewResult" type="string[]"/>
    <aura:attribute name="objectInfo" type="string" default="Case"/>
    <aura:attribute name="currentListViewName" type="string" />
    <aura:attribute name="bShowListView" type="boolean" default="false"/> 
    
  <!-- custom dropdown to display available list view options-->
    <div class="slds-form-element">
        <lightning:select name="select1" onchange="{!c.onPicklistChange}" label=" " class="customCls">
            <aura:iteration items="{!v.listViewResult}" var="listView">
                <option value="{!listView.developerName}">{!listView.label}</option>
            </aura:iteration> 
        </lightning:select> 
    </div>
   
   <!-- lightning List View : https://sforce.co/2Q4sebt--> 
    <aura:if isTrue="{!v.bShowListView}">
        <lightning:listView objectApiName="{!v.objectInfo}"
                            listName="{!v.currentListViewName}"
                            rows="10"
                            showSearchBar="true"
                            showActionBar="false"
                            enableInlineEdit="true"
                            showRowLevelActions="false"
                            />
    </aura:if> 
</aura:component>


CustomListViewController.js


({
    doInit : function(component, event, helper) {
        // call apex method to fetch list view dynamically 
        var action = component.get("c.listValues");
        action.setParams({
            "objectInfo" : component.get("v.objectInfo")
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var listViewResult = response.getReturnValue();
                if(listViewResult.length > 0){
                    // set listViewResult attribute with response
                    component.set("v.listViewResult",listViewResult);
                    // set first value as default value
                    component.set("v.currentListViewName", listViewResult[0].developerName);
                    // rendere list view on component
                    component.set("v.bShowListView", true);     
                }            } 
            else if (state === "INCOMPLETE") {
            }
                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(action);
    },
    
    onPicklistChange: function(component, event, helper) {
        // unrenders listView 
        component.set("v.bShowListView", false); 
        
        // get current selected listview Name 
        var lstViewName = event.getSource().get("v.value"); 
        
        // set new listName for listView
        component.set("v.currentListViewName", lstViewName);
        
        // rendere list view again with new listNew  
        component.set("v.bShowListView", true); 
    },
})
Order Remarks filed is mandatary if the order stage is Cancelled else system should display the error message “Order Remarks filed is mandatary, Please enter the remarks”.
Here stage is a picklist having a value "Cancelled"?