• VRK
  • NEWBIE
  • 205 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 87
    Questions
  • 67
    Replies
Hi my requirement is:
User-added imageHi,
My requirement is :
Parent comp :  NewSkillQuickAction
Child Comp : GlobalSearchComp1.

by using child component , when i click on 'Search' buton i can populate results and display iin parent component.
When i select any radio button and try to save the record getting Insertation Failed and populating below error ::
Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Skill Management: value not of required type: [{Id=a0V9E000008sxqZUAQ, Name=Test audit, Skill_Category__c=Quality Engineering, Skills__c=Testing}]: [Skill_Management__c]

Pls find below my complete code :
public class GlobalSearchHandler1{
    
    @AuraEnabled(cacheable=true)
    public static List<List<sObject>> getSearchRecords(String searchKey){      
        List<List<sObject>> searchResult = [FIND :searchKey IN ALL FIELDS RETURNING
                                            Skill_Management__c (Id, Name, Skill_Category__c, Skills__c)];
        return searchResult;
      
    }
 }
 
 GlobalSearchComponent1 :::
 <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="GlobalSearchHandler1">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>    
    <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
    <aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>
    <aura:attribute name="showSearchResults" type="Boolean" default="false"/>
    <aura:attribute name="searchKey" type="String"/>
    <aura:attribute name="accountList" type="List" default="Account[]"/>
    <aura:attribute name="accountColumns" type="List"/>
    <aura:attribute name="contactList" type="List" default="Contact[]"/>
    <aura:attribute name="contactColumns" type="List"/>
    <aura:attribute name="oppList" type="List" default="Opportunity[]"/>
    <aura:attribute name="oppColumns" type="List"/>
    <aura:attribute name="leadList" type="List" default="Lead[]"/>
    <aura:attribute name="leadColumns" type="List"/>
    <aura:attribute name="Spinner" type="boolean" default="false"/>
    <!--loading spinner start... style=Brand Medium (blue dots)-->
    
    <aura:registerEvent name="oSelectedRecordEvent" type="c:skillCompEvent"/>

    
    <aura:if isTrue="{!v.Spinner}">
        <div aura:id="spinnerId" class="slds-spinner_container">
            <div class="slds-spinner--brand  slds-spinner slds-spinner--large slds-is-relative" role="alert">
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </aura:if>
    <!-- Loading spinner end-->   
    <lightning:layout multipleRows="true">
        <lightning:layoutItem padding="around-small" size="6">
            <lightning:input name="searchKey" placeholder="Enter Search Key" value="{!v.searchKey}"/>
        </lightning:layoutItem>
        <lightning:layoutItem padding="around-small" size="3">
            <lightning:button variant="brand" label="Search" title="Search" onclick="{!c.search}" class="SearchButton"/>
        </lightning:layoutItem>
    </lightning:layout>
    
    <aura:if isTrue="{!v.showSearchResults}">
        <lightning:layout multipleRows="true">
            <lightning:layoutItem padding="around-small" size="12">
                <span style="font-size:16px;font-weight:bold">Account</span>
                <lightning:datatable keyField="id"  aura:id="accountTable"
                                     data="{!v.accountList}"
                                     columns="{!v.accountColumns}"
                                     maxRowSelection="1"
                                     onrowselection="{! c.getSelectedName }" />
            </lightning:layoutItem>
            
        </lightning:layout>
    </aura:if>  
 </aura:component>
 
 Controller:
 
 ({
    doInit: function (component, event, helper){
        component.set('v.accountColumns', [
            {label: 'Name', fieldName: 'Name', type: 'text'},
            {label: 'Skill Category', fieldName: 'Skill_Category__c', type: 'text'},
            {label: 'Skill', fieldName: 'Skills__c', type: 'url', type: 'text'}
        ]);
        
    },
    
    search : function(component, event, helper) {
        helper.getSearchResultsFromHandler(component,helper);
        component.set("v.showSearchResults",true);
    },
    
    // this function automatic call by aura:waiting event  
    showSpinner: function(component, event, helper) {
        // make Spinner attribute true for display loading spinner 
        component.set("v.Spinner", true); 
    },
    
    // this function automatic call by aura:doneWaiting event 
    hideSpinner : function(component,event,helper){
        // make Spinner attribute to false for hide loading spinner    
        component.set("v.Spinner", false);
    },
getSelectedName: function (component, event,helpder) {        
        var selectedRows = event.getParam('selectedRows');
        var setRows = [];    
        // Display that fieldName of the selected rows
        for (var i = 0; i < selectedRows.length; i++){ 
            setRows.push(selectedRows[i]);
            alert("You selected Skill Category option as : " + selectedRows[i].Skill_Category__c );
        }
// component.set("v.selectedAccts", setRows);  
     var dTable = component.find("accountTable");
       dTable.set("v.selectedRows", setRows);
  }        
 })

Helper :
({
    getSearchResultsFromHandler : function(component,helper){      
        var action = component.get("c.getSearchRecords");
        action.setParams({ searchKey : component.get("v.searchKey") });
        
        // callback that is executed after the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();
                // SOSL will always return the list in the order they were queried
                component.set("v.accountList",result[0]);
            }
            else if (state === "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(action);
    },
 })

-----------------Parent component----------------------
<aura:component controller="PickListController" implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickActionWithoutHeader">
    
    <aura:attribute name="newresource" type="Resourse__c"/>
    <aura:attribute name="newSkill" type="Skill__c" default="{ 'sobjectType': 'Skill__c'}"/>
    <aura:attribute name="SkillManagement" type="Skill_Management__c" default="{ 'sobjectType': 'Skill_Management__c'}"/>
    
    <aura:attribute name="recordId" type="String"/>
    <aura:attribute name="picvalue" type="List"/>

    <aura:attribute name="value" type="List" />
    <aura:attribute name="selectedSkills" type="List"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    <div class="slds-page-header" role="banner">
        <h2 class="slds-page-header__title slds-m-right_small
            slds-align_absolute-center">Add Skill</h2>   
     </div>
             <!-- Display the new Skill form -->

<c:CustomLookup objectName="Resourse__c" fieldName= "Name" label="Resource" iconName="custom:custom11" value="{!v.recordId}" aura:id='resourcerole' />
 <c:GlobalSearchComponent1 accountList="Skill_Management__c" selectedAccts = "{!v.newSkill.Skill_Management__c}" aura:id = "skillMgt"/>

       <lightning:layout>
                <lightning:layoutItem> 
            <lightning:button label="Cancel" onclick="{!c.handleCancel}" class="slds-m-top_medium" />
            <lightning:button label="Create New SKill" variant="brand" onclick="{!c.handleSaveContact}" class="slds-m-top_medium"/>
   </lightning:layoutItem>
                </lightning:layout>
</aura:component>

controller :
({
        var action = component.get("c.getResource");
        action.setParams({"resourceId": component.get("v.recordId")});

        // Configure response handler
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS") {
                component.set("v.account", response.getReturnValue());
            } else {
                console.log('Problem getting account, response state: ' + state);
            }
        });
        $A.enqueueAction(action);
        
    },
    handleComponentEvent  : function(component, event, helper) {
        // get the selected Account record from the COMPONETN event      
       var selectedAccountGetFromEvent = event.getParam("recordByEvent");
        component.set("v.newSkill.Skill_Management__c" , selectedAccountGetFromEvent); 
    },
    
    handleSaveContact: function(component, event, helper) {
        var skillMgt = component.find("skillMgt");
        var action = component.get("c.insertValues");
        action.setParams({
            ac : component.get("v.newSkill"),
           "resourceId": component.get("v.recordId")
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS'){
                var list = response.getReturnValue();
                 component.set("v.newSkill", list);
                // Prepare a toast UI message
                    var resultsToast = $A.get("e.force:showToast");
                    resultsToast.setParams({
                       
                        "message": "The Record Is Created Sucessfully"
                    });
                // Update the UI: close panel, show toast, refresh account page
                    $A.get("e.force:closeQuickAction").fire();
                    resultsToast.fire();
                    $A.get("e.force:refreshView").fire();
               
            }
            else if(state === 'INCOMPLETE'){
                alert('Something is missing');   
            }
                else if(state === 'ERROR'){
                    alert('Insertion Failed');   
                }
        })
        $A.enqueueAction(action);
    },
    
    handleCancel: function(component, event, helper) {
        $A.get("e.force:closeQuickAction").fire();
    }
    
})

Apex class :
public class PickListController {
@AuraEnabled
    public static Resourse__c getResource(Id resourceId) {
        // Perform isAccessible() checks here
        return [SELECT Id,Name FROM Resourse__c WHERE Id = :resourceId];
    }
@AuraEnabled        
    public static Skill__c insertValues(Skill__c ac,Id resourceId){
       ac.Resource__c = resourceId;
        insert ac; 
        return ac;  
       
    }
}
 
  • February 26, 2022
  • Like
  • 0
Hi All,
I can able to prepopulate other lookup fields . But getting issue with Date format .

My expected result date is : 31/03/2022 
But when i test it, it is displaying As  20/03/2031.
Its date format issue....

Pls check below my code ..


/lightning/o/Resourse__c/new?&defaultFieldValues=
Capability__c={!OpportunityLineItem.Id},
Resource_Start_Date__c={!Opportunity.FR_Start_Date__c},
Resource_End_Date__c={!Opportunity.FR_End_Date__c},
Opp_Engagement_Type__c={!Text(Opportunity.Engagement_Type__c)}

Pls let me know is there anything wrong on this
Thanks
  • February 25, 2022
  • Like
  • 0

Hi All,
I can able to fetch select 'Search Results' in child component from Parent Component.
But when i try to save the record , its unable to save the record.
can some one pls check and let me  know whats wrong in the code

Event :

skillCompEvent :::
<aura:event type="COMPONENT">
    <aura:attribute name="recordByEvent"  type="List"/>
</aura:event>

----------------------- child Comp--------------
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="GlobalSearchHandler">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>    
    <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
    <aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>
    <aura:attribute name="showSearchResults" type="Boolean" default="false"/>
    <aura:attribute name="searchKey" type="String"/>
    <aura:attribute name="accountList" type="List" default="Skill_Management__c[]"/>
    <aura:attribute name="accountColumns" type="List"/>
    <aura:attribute name="Spinner" type="boolean" default="false"/>
    <aura:attribute name="label" type="string" default="" description="Label will be displayed above input Box" />
    <aura:attribute name="selectedAccts" type="List"/>  
    <aura:attribute name="value" type="String" default="" />

    <aura:registerEvent name="oSelectedRecordEvent" type="c:skillCompEvent"/>
    <aura:if isTrue="{!v.Spinner}">
        <div aura:id="spinnerId" class="slds-spinner_container">
            <div class="slds-spinner--brand  slds-spinner slds-spinner--large slds-is-relative" role="alert">
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </aura:if>
    <!-- Loading spinner end-->  
    
      <lightning:input name="searchKey" placeholder="Search Skill Management" value="{!v.searchKey}"/>
      <lightning:button variant="brand" label="Search" title="Search" onclick="{!c.search}" class="SearchButton"/>
 <!--   </div> -->
    
    <aura:if isTrue="{!v.showSearchResults}">
        <lightning:layout multipleRows="true">
            <lightning:layoutItem padding="around-small" size="12">
                <span style="font-size:16px;font-weight:bold">Skill Management</span>
                <lightning:datatable keyField="id"
                                     data="{!v.accountList}"
                                     columns="{!v.accountColumns}"
                                     maxRowSelection="1"
                                     onrowselection="{! c.getSelectedName }"
                                     
                                     />
            </lightning:layoutItem>
        </lightning:layout>
    </aura:if>  
 </aura:component>
 
 controller:
 ({
    doInit : function(component, event, helper) {
        component.set('v.accountColumns', [
            {label: 'Name', fieldName: 'Name', type: 'text'},
            {label: 'Skill Category', fieldName: 'Skill_Category__c', type: 'text'},
            {label: 'Skill', fieldName: 'Skills__c', type: 'text'}
        ]);
    },
    search : function(component, event, helper) {
        helper.getSearchResultsFromHandler(component,helper);
        component.set("v.showSearchResults",true);
    },
    
    // this function automatic call by aura:waiting event  
    showSpinner: function(component, event, helper) {
        // make Spinner attribute to false for hide loading spinner    
        component.set("v.Spinner", false);
    },
    
    getSelectedName: function (component, event,helpder) {        
        var selectedRows = event.getParam('selectedRows');
        var setRows = [];    
        // Display that fieldName of the selected rows
        for (var i = 0; i < selectedRows.length; i++){ 
            setRows.push(selectedRows[i]);
        } 
         component.set('v.value',selectedRows);
        var compEvent = component.getEvent("oSelectedRecordEvent");
        alert('called compEvent');
        compEvent.setParams({
            "recordByEvent" : setRows[0]
        });  
        compEvent.fire();
        // ended code
    }
})

Helper :
({
    getSearchResultsFromHandler : function(component,helper){  
        var action = component.get("c.getSearchRecords");
        action.setParams({ searchKey : component.get("v.searchKey") });
        // callback that is executed after the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();
                // SOSL will always return the list in the order they were queried
                component.set("v.accountList",result[0]);
            }
            else if (state === "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(action);
    },
    
    
})
---------------------Parent component---------------
<aura:component controller="PickListController" implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickActionWithoutHeader">
    
    <aura:attribute name="newresource" type="Resourse__c"/>
    <aura:attribute name="newSkill" type="Skill__c" default="{ 'sobjectType': 'Skill__c'}"/>
    <aura:attribute name="recordId" type="String"/>
    <aura:attribute name="picvalue" type="List"/>
    <aura:attribute name="value" type="String" />
    <aura:attribute name="selectedSkills" type="List"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:handler name="oSelectedRecordEvent" event="c:skillCompEvent" action="{!c.handleComponentEvent}"/>
    <div class="slds-page-header" role="banner">
        <h2 class="slds-page-header__title slds-m-right_small
                   slds-align_absolute-center">Add Skill</h2>   
    </div>
    <c:GlobalSearchComponent accountList="Skill_Management__c" label="Skill Management" value="{!v.value}" />

    <lightning:select value="{!v.newSkill.Rating__c}" label="Rating">       
        <option value="choose">Choose one...</option> 
        <aura:iteration items="{!v.picvalue}" var="s">
            <option value="{!s}">{!s}</option>
        </aura:iteration> 
    </lightning:select> 
    
    <br/> <br/>     
    <lightning:layout>
        <lightning:layoutItem> 
            <lightning:button label="Cancel" onclick="{!c.handleCancel}" class="slds-m-top_medium" />
            <lightning:button label="Create New SKill" variant="brand" onclick="{!c.handleSaveContact}" class="slds-m-top_medium"/>
        </lightning:layoutItem>
    </lightning:layout>
    
</aura:component>

controller :

({
    doInit : function(component) {        
        var pickvar = component.get("c.getPickListValuesIntoList");
        pickvar.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS'){
                var list = response.getReturnValue();
                component.set("v.picvalue", list);
            }
            else if(state === 'ERROR'){
                alert('ERROR OCCURED.');
            }
        })
        $A.enqueueAction(pickvar);
        
        var action = component.get("c.getResource");
        action.setParams({"resourceId": component.get("v.recordId")});
        
        // Configure response handler
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS") {
                component.set("v.account", response.getReturnValue());
            } else {
                console.log('Problem getting account, response state: ' + state);
            }
        });
        $A.enqueueAction(action);
        
    },
    
    // This function call when the end User Select any record from the result list.   
    handleComponentEvent : function(component, event, helper) {
        var selectedAccountGetFromEvent = event.getParam("recordByEvent");        
        component.set("v.value" , selectedAccountGetFromEvent);
    },
        handleSaveContact: function(component, event, helper) {
        
        var action = component.get("c.insertValues");
        action.setParams({
            ac : component.get("v.newSkill"),
            "resourceId": component.get("v.recordId")
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS'){
                var list = response.getReturnValue();
                component.set("v.picvalue", list);
                component.set("v.newSkill", list);
                
                // Prepare a toast UI message
                var resultsToast = $A.get("e.force:showToast");
                resultsToast.setParams({
                    
                    "message": "The Record Is Created Sucessfully"
                });
                // Update the UI: close panel, show toast, refresh account page
                $A.get("e.force:closeQuickAction").fire();
                resultsToast.fire();
                $A.get("e.force:refreshView").fire();
                
            }
            else if(state === 'INCOMPLETE'){
                alert('Something is missing');   
            }
                else if(state === 'ERROR'){
                    alert('Insertion Failed');   
                }
        })
        $A.enqueueAction(action);
    },
    
    handleCancel: function(component, event, helper) {
        $A.get("e.force:closeQuickAction").fire();
    }
    
})

                     Apex class :
 public class PickListController {
    @AuraEnabled        
    public static List<String> getPickListValuesIntoList(){
        List<String> pickListValuesList = new List<String>();
        Schema.DescribeFieldResult fieldResult = Skill__c.Rating__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry pickListVal : ple){
            pickListValuesList.add(pickListVal.getLabel());
            System.debug('Values in Rating are: '+pickListValuesList);
        }     
        return pickListValuesList;
    }
    @AuraEnabled        
    public static Skill__c insertValues(Skill__c ac,Id resourceId){
        system.debug('acc'+ac);
        insert ac;   
        return ac;  
       
    }
}
 

  • February 22, 2022
  • Like
  • 0

Hi All,
When i run the test class, it covers only 50% not covering the  For loop condition , can you pls help me how to cover this :
User-added image
Apex class:
public class SortedLineItemsController {
public Opportunity opportunity { get; set; }
    
    public OpportunityLineItem[] getSorted() {
        if (opportunity == null || opportunity.opportunityLineItems== null) {
            return null;
        }
        
        // TODO: Add your sorting logic here (demo just reverses the list)
        OpportunityLineItem[] result = new OpportunityLineItem[1];
        for (OpportunityLineItem item : opportunity.opportunityLineItems) {
            result.add(0, item);
        }
        
        return result;
   }
}

Test class :

@isTest
public class SortedLineItemsController_Test {
    @isTest static void insertOpp() {
        Id pricebookId = Test.getStandardPricebookId();
        
        Test.startTest();
        // insert product
        Product2 p = new Product2();
        p.Name = ' Test Product ';
        p.Description='Test Product Entry For Product';
        p.productCode = 'SFDCPanther-123';
        p.isActive = true;
        insert p;
        
        // insert pricebook entry for the product
        PricebookEntry standardPrice = new PricebookEntry();
        standardPrice.Pricebook2Id = Test.getStandardPricebookId();
        standardPrice.Product2Id = p.Id;
        standardPrice.UnitPrice = 100;
        standardPrice.IsActive = true;
        standardPrice.UseStandardPrice = false;
        insert standardPrice ;
        
        Account testAccount1 = new Account();
        testAccount1.Name = 'Test Account 1';
        testAccount1.Industry__c    = 'Aerospace';
        insert testAccount1;
        
        Opportunity testOpportunity1 = new Opportunity();
        testOpportunity1.Name = 'Test Opportunity';
        testOpportunity1.AccountId = testAccount1.Id;
        testOpportunity1.StageName = '0 - Qualify Opportunity';
        testOpportunity1.Probability_2__c = '10%' ;
        testOpportunity1.CloseDate = system.today() + 10;
        testOpportunity1.Pricebook2Id = Test.getStandardPricebookId();
        
        insert testOpportunity1; 
        
        Opportunity testOpportunity2 = new Opportunity();
        testOpportunity2.Name = 'Test Opportunity';
        testOpportunity2.AccountId = testAccount1.Id;
        testOpportunity2.StageName = '0 - Qualify Opportunity';
        testOpportunity2.Probability_2__c = '10%' ;
        testOpportunity2.CloseDate = system.today() + 10;
        testOpportunity2.Pricebook2Id = Test.getStandardPricebookId();
        
        insert testOpportunity2; 
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem = new OpportunityLineItem();
        oppLineItem.OpportunityId = testOpportunity1.Id;
        oppLineItem.PricebookEntryId = standardPrice.Id;
        oppLineItem.UnitPrice = 7000.00;
        oppLineItem.Quantity = 5;
        oppLineItem.Amount_Updated__c = True;
        oppLineItem.Service_Percentage__c = 10;
        insert oppLineItem;
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem1 = new OpportunityLineItem();
        oppLineItem1.OpportunityId = testOpportunity2.Id;
        oppLineItem1.PricebookEntryId = standardPrice.Id;
        oppLineItem1.UnitPrice = 6000.25;
        oppLineItem1.Quantity = 5;
        oppLineItem1.Amount_Updated__c = True;
        oppLineItem1.Service_Percentage__c = 15;
        insert oppLineItem1;
        
        
        SortedLineItemsController slic = new SortedLineItemsController();
        List<OpportunityLineItem> slic_q = slic.getSorted();
        OpportunityLineItem[] slic_qli = slic.getSorted();
        OpportunityLineItem[] slic_qli1 = slic.getSorted(); 
        
        Test.stopTest();
    }
}

can you  pls check and let me know how to cover ...

Thanks in Advance

  • February 22, 2022
  • Like
  • 0
Hi am trying to display related contacts details for Account Hirearchy .
for example 

Parent Accoun1 (Grand parent)
        --> Test contact1    abc@gmail.com      122345566
        --> Test contact2    abcd@gmail.com     5122345566

           childParentAccount1 ( childParentAccount is child of Parent Account):
        --> Test contact3    a1bc@gmail.com      6122345566
        --> Test contact4    coc@gmail.com      1225645566

                     childChildParentAccount2 (childChildParentAccount2 is child of childParentAccount1 )
                --> Test contact4    a1bc@gmail.com      6122345566
                 --> Test contact5   a1bc@gmail.com      6122345566.

I tried below code, but its can display only one Level .......but not display for leve2 , level 3 ...........

<aura:component  controller="TreeGridExamples" implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickActionWithoutHeader">
   <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="gridColumns" type="List" />
    <aura:attribute name="gridData" type="Object" />
    <aura:attribute name="gridExpandedRows" type="Object" />
    
    <lightning:treeGrid columns="{! v.gridColumns }"
                        data="{! v.gridData }"
                        keyField="name"
                        aura:id="mytree"
                        hideCheckboxColumn="true"
                        />  
    
</aura:component>

controller :
({
     doInit : function(component, event, helper) {
        
        component.set('v.gridColumns', [
            {label: 'name', fieldName: 'name', type: 'text'}
            
        ]);
            helper.getData(component);
            
         }
})

Helper :
({
    getData : function (cmp) {
        var action = cmp.get("c.getTreeGridData");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var data = response.getReturnValue();
                var temojson = JSON.parse(JSON.stringify(data).split('items').join('_children'));
                console.log(temojson);
                cmp.set('v.gridData', JSON.parse(temojson));
            }
            // error handling when state is "INCOMPLETE" or "ERROR"
        });
        $A.enqueueAction(action);
    }
})

Apex class:
public class TreeGridExamples {
  @AuraEnabled
    public static String getTreeGridData(String AccountId){
      
        List<Account> accs = [Select Id , Name,(Select Id , Name,Title,Phone,Email from Contacts) from Account];
        system.debug('accs1........'+accs);
        Map<Id , Contact> opps =new Map<Id , Contact>( [Select Id , Name,(Select Id ,Name From Opportunities) from Contact]);
        
        List<AccountWrapper> aooo = new List<AccountWrapper>();
        for(Account a : accs){
            AccountWrapper aWraper = new AccountWrapper() ; 
            aWraper.name =a.Name ;
            aWraper.label =a.Name ;
            List<Items> co = new List<Items>();
            for(Contact c : a.Contacts){
                Items conWrapp = new Items();
                conWrapp.name =c.Name ;
                conWrapp.label =c.Name ;
                conWrapp.title =c.Title ;
                conWrapp.phone =c.Phone ;
                conWrapp.email =c.Email ;
                
                co.add(conWrapp);
            }
            aWraper.items = co;
            aooo.add(aWraper);
            
        }
        return JSON.serializePretty(aooo) ;
    } 
    public Class AccountWrapper{
        @AuraEnabled
        public String name {get;set;}
        @AuraEnabled
        public String label {get;set;}
        @AuraEnabled
        public List<Items> items {get;set;}
    }
    public Class Items{
        @AuraEnabled
        public String name {get;set;}
        @AuraEnabled
        public String label {get;set;}
        @AuraEnabled
        public String title {get;set;}
        @AuraEnabled
        public String phone {get;set;}
        @AuraEnabled
        public String email {get;set;}
        @AuraEnabled
        public List<Items> items {get;set;}
    }
}

Pls check and let me know whats wrong here in this code

Thanks
 
  • February 18, 2022
  • Like
  • 0
Hi All,
We got below requirement from Business :

Display field details in the email alert
 
  • Opportunity Name
  • Account Name
  • Opportunity Owner
  • Amount
  • Close Date
  • Any attachments uploaded in Salesforce
  • Note: these emails will be going to contacts who do not have Salesforce accounts so all information above needs to be fully viewable in the email and the email needs to provide access to all attachments
I verified, there is no option to  adding existing opportunity records to the email templates .

Please let me know if anyone have idea, How to acheive this functionality.

Thanks
VRK
 
  • February 16, 2022
  • Like
  • 0
Hi,
my request is How to display JSON Response in Table format in LWC Component.

This is my sample JSON Response #
  "fullDataJson": {
    "response": {},
    "ResponseAction_MPAServiceCheckStatus": true,
    "HTTPAction_MPAService": {
      "broadbandCoverage": {
        "SUPPLEMENTARYMSG": "If you decide to place an order for a WBC fibre product, an appointment may be required for an engineer to visit the end user's premises to supply the service.Thank you for your interest.",
        "SUGGESTEDMSG": "Our records show the following FTTP network service information for these premises:-Multi Dwelling Unit Residential .ONT exists with active service. A spare port is available. A new ONT may be ordered.For all ADSL and WBC Fibre to the Cabinet (VDSL or G.fast) services, the stable line rate will be determined during the first 10 days of service usage.No Market information is available.Actual speeds experienced by end users and quoted by CPs will be lower due to a number of factors within and external to BT's network, Communication Providers' networks and within customer premises.In order to be eligible for handback, downstream speed should be less than Downstream Handback Threshold values.",
        "WBCFTTPFLAG": "N",
        "POSTCODE": "",
        "MARKETEXCHANGE": "",
        "NTELOCATIONRECORDED": "",
        "NTETYPERECORDED": "",
        "GFASTCABINETUNAVAILABILITYREASON": "",
        "CABINETUNAVAILABILITYREASON": "",
        "FCPID": "",
        "PCPID": "100",
        "EXCHANGENAME": "Havel",
        "EXCHANGECODE": "NICK",
        "LISTOFOPENORDER": "",
        "PRODUCTWITHDRAWAL": {
          "IPSLASTMODIFY": "",
          "IPSLASTPROVIDE": "",
          "DSLASTMODIFY": "",
          "DSLASTPROVIDE": ""
        },
        "GFASTMULTICAST": {
          "EXCHSTATE": "N",
          "READYDATE": ""
        },
        "FIBREMULTICAST": {
          "EXCHSTATE": "E",
          "READYDATE": ""
        },
        "COPPERMULTICAST": {
          "EXCHSTATE": "E",
          "READYDATE": ""
        },
        "OBSERVEDSPEED": {
          "ADSLBANDWIDTH": {
            "LASTOBSERVEDDATE": "",
            "UPSTREAMOBSERVEDMALR": "",
            "DOWNSTREAMOBSERVEDMALR": "",
            "UPSTREAMOBSERVEDSYNCSPEED": "",
            "DOWNSTREAMOBSERVEDSYNCSPEED": ""
          },
          "VDSLBANDWIDTH": {
            "LASTOBSERVEDDATE": "",
            "DLMPOLICY": "",
            "UPSTREAMDLMPROFILECAP": "",
            "DOWNSTREAMDLMPROFILECAP": "",
            "UPSTREAMPRODUCTCAP": "",
            "DOWNSTREAMPRODUCTCAP": "",
            "LOWERUPSTREAMOBSERVEDSPEED": "",
            "UPPERUPSTREAMOBSERVEDSPEED": "",
            "LOWERDOWNSTREAMOBSERVEDSPEED": "",
            "UPPERDOWNSTREAMOBSERVEDSPEED": "",
            "RANGEBBASEUPSTREAMBANDWIDTH": "118.8",
            "RANGEABASEUPSTREAMBANDWIDTH": "178.2"
          },
          "G.FASTBANDWIDTH": {
            "LASTOBSERVEDDATE": "",
            "DLMPOLICY": "",
            "UPSTREAMPRODUCTCAP": "",
            "DOWNSTREAMPRODUCTCAP": "",
            "LOWERUPSTREAMOBSERVEDSPEED": "",
            "UPPERUPSTREAMOBSERVEDSPEED": "",
            "LOWERDOWNSTREAMOBSERVEDSPEED": "",
            "UPPERDOWNSTREAMOBSERVEDSPEED": "",
            "RANGEBBASEUPSTREAMBANDWIDTH": "207.9",
            "RANGEABASEUPSTREAMBANDWIDTH": "267.3"
          }
        },
        "FTTPONDEMAND": {
          "CAPACITY": "",
          "EXCHSTATE": "N",
          "READYDATE": "",
          "UPSPEED": "",
          "DOWNSPEED": "",
          "REASONCODE": "",
          "RAG": ""
        },
        "WBCFTTP": {
          "offers": [
            {
              "productMinimumGuaranteedSpeed": "0.2",
              "productAdvertisedUploadSpeed": "0.4",
              "productAdvertisedDownloadSpeed": "0.4",
              "productHighUploadSpeed": "0.4",
              "productLowDownloadSpeed": "",
              "productHighDownloadSpeed": "0.5",
              "productLowUploadSpeed": "",
              "id": "FTTP 0.5_0.5M"
            },
            {
              "productMinimumGuaranteedSpeed": "19",
              "productAdvertisedUploadSpeed": "9.5",
              "productAdvertisedDownloadSpeed": "38",
              "productHighUploadSpeed": "9.2",
              "productLowDownloadSpeed": "",
              "productHighDownloadSpeed": "36.8",
              "productLowUploadSpeed": "",
              "id": "FTTP 40_10M"
            },

Now i want to display this data in Table format in LWC component.
pls let me know if any one have idea on this requirment .

Thanks 
VRK
  • August 24, 2021
  • Like
  • 0
Hi folks,
we plan to migrate existing data from thousand to millions .
my approach here is :
i. i need to export data 
ii. convert thousand to millions in excel sheet
iii. update new data 

But i am in struck in convert data to Million ....i saw few articles in google, its not much clear .
exisitng field data type is (Currency(16, 1)
 
11434
1828786
960
14426
2862161
2056369
2342
 

can anyone help me to covert data to Millions ....in excel .

or if you have any best approaches pls suggest 
Thanks 
VRK
  • June 04, 2021
  • Like
  • 0
Sub : Sort order not workign for Dependent picklist fields for Product 
Hi folks,
i have 3 picklist fields : Team, product and stragy
Based on Team selection Product values will display ...
For Team picklist felds SORT function is working BUT for product picklist Field SORT is not working 
can any one pls check my code and let me know your ideas to fix this 
Comp:
        <div class="slds-col slds-size_1-of-1 slds-medium-size_4-of-12 slds-large-size_4-of-12 slds-small-size_12-of-12 slds-p-bottom_medium">
            <lightning:combobox aura:id="teamSelect" 
                                name="teamSelect" 
                                label="Select a Team" 
                                required="true" 
                                messageWhenValueMissing="Please select a Team to proceed."
                                options="{!v.teamOptions}"
                                placeholder="Select a Team"
                                onchange="{!c.handleTeamSelect}"
                                value="{!v.selectedTeam}"
                                disabled="{!v.oppProduct.MKS_IsConverted__c || v.oppProduct.MKS_IsMigrated__c}"/>       
        </div>
        <div class="slds-col slds-size_1-of-1 slds-medium-size_4-of-12 slds-large-size_4-of-12 slds-small-size_12-of-12 slds-p-bottom_medium">
            <lightning:combobox aura:id="productSelect" 
                                name="productSelect" 
                                label="Select a Product" 
                                required="true" 
                                messageWhenValueMissing="Please select a Product to proceed."
                                options="{!v.productOptions}"
                                placeholder="Select a Product"
                                onchange="{!c.handleProductSelect}"
                                disabled="{!v.selectedTeam == null || v.selectedTeam.length == 0 || v.oppProduct.MKS_IsConverted__c || v.oppProduct.MKS_IsMigrated__c}"
                                value="{!v.selectedProduct}"/>
        </div>

Controller:
    handleTeamSelect : function(component, event, helper){
        var selectedTeam = event.getParam("value");
        component.set("v.selectedTeam", selectedTeam);
        helper.getProducts(component, event);
        component.find("productSelect").set("v.disabled", false);
        component.find("productSelect").set("v.value", false);
        component.find("strategySelect").set("v.value", false);
        component.set("v.selectedProduct", null);
        component.set("v.selectedStrategy", null);
    },
    
    //method to handle product selection and render available strategies for selection
    handleProductSelect : function(component, event, helper){
        component.find("productSelect").setCustomValidity("");
        var selectedProduct = event.getParam("value");
        component.set("v.selectedProduct", selectedProduct);
        component.set("v.selectedStrategy", null);
        helper.getStrategies(component, event);
        component.find("strategySelect").set("v.disabled", false);
        component.find("strategySelect").set("v.value", false);
    },

Helper :
    //helper method to get all available teams for selection
    getTeams : function(component){
        var action = component.get("c.getStrategies");
        action.setStorable();
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                var result = JSON.parse(response.getReturnValue());
                component.set("v.hierarchy", result);
                console.log('Team size: '+result.teams.length);
                var teamOptions = "[";
                for(var i = 0; i< result.teams.length; i++){
                    teamOptions += "{ \"value\": \""+result.teams[i].id+"\", \"label\": \""+result.teams[i].name+"\"},";
                }
                if(teamOptions.length > 1){
                    teamOptions = teamOptions.slice(0, -1);
                }
                teamOptions += "]";
                var teamList = JSON.parse(teamOptions);
                console.log('team options: '+teamList);
                component.set("v.teamOptions", teamList);
            }
        });
        $A.enqueueAction(action);
    },
    
    //helper method to get products available for the selected team
    getProducts : function(component, event){
        var teamId = component.get("v.selectedTeam");
        var heir = component.get("v.hierarchy");
        var oppProduct = component.get("v.oppProduct");
        var prods = [];
                if(oppProduct == null || (oppProduct != null && !oppProduct.MKS_IsMigrated__c)){
            for(var i = 0; i < heir.teams.length; i++){
                if(heir.teams[i].id == teamId){
                    prods = heir.teams[i].products;
                    break;
                }
            }
        }else{
            for(var i = 0; i < heir.products.length; i++){
                if(oppProduct.Product2Id == heir.products[i].id){
                    prods.push(heir.products[i]);
                    break;
                }
            }
        }
         component.set("v.products", prods);
        
        var prodOptions = "[";
        for(var i = 0; i < prods.length; i++){
            prodOptions +=  "{ \"value\": \""+prods[i].id+"\", \"label\": \""+prods[i].name+"\"},";   
        }
        if(prodOptions.length > 1){
            prodOptions = prodOptions.slice(0, -1);
        }
        prodOptions += "]";
        var prodList = JSON.parse(prodOptions);
       component.set("v.productOptions", prodList);
    },

Thanks 
VRK

 
  • May 17, 2021
  • Like
  • 0
Hi ..
HI i am created one formula field which fetch value of StageName( picklist ) value.
if picklist value select As 01 - Funded, the formula field updated As 01.
if picklist value select As 02 - Approved, the formula field updated As 02.
Below coding is working fine, But i need write Dynmic instead of pass static Values.
We have 100 picklist values, So is there any way to write logic as dynamic ..

IF(ISPICKVAL( StageName , "01 - Funded"), "01",
IF(ISPICKVAL( StageName , "02 - Approved"), "02",
IF(ISPICKVAL( StageName , "03 - Underwriting - In Process"), "03",
IF(ISPICKVAL( StageName , "04 - Term Sheet Issued/Pre-Underwriting"), "04", ""))))

Thanks
VRK
  • March 25, 2021
  • Like
  • 0
Hi
i am having issues with Custom Clone button , can anyone pls check and  help on this .
Issue :
When click on Custom Clone Button , open popup page and close WITHOUT modify any fields on the popup page.
When refresh page, duplicate record is created .

Issue Replication steps:
Navigate to any opportunity record page and click on Custom Clone Button 
ii. Then open popup window with existing record Values
iii. click on Cancel Button ( Not selecting Save Record)
iv. Refresh page, then duplicate opporunity record created.

code:
comp:
<aura:component controller="NYL_CloneDeal"  implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="recordId" type="Id" /> 
                  
   <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>  
</aura:component>

Controller:
({
     doInit : function(component, event, helper) {
        var action = component.get("c.cloneDealWithTeam");
        action.setParams({ "DealID": component.get("v.recordId")});
        action.setCallback( this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();  
                 if(result.includes('error')){               /// display error message 
                   alert(result); 
                    return false;
                     
                }  
                    window.open(window.location.origin + '/' + result + '/e?retURL=' + result,'_self');
               
                var dismissActionPanel = $A.get("e.force:closeQuickAction");
                dismissActionPanel.fire();
            }
        });
        $A.enqueueAction(action);
    },
})


Apex class:

@AuraEnabled
  webservice static String cloneDealWithTeam(String DealID) {
    Boolean roleOriginator1 = false;
    Boolean mcfRoleOriginator1 = false;
    Integer iterationNumber = -1;
    Integer mcfIterationNumber = -1;
    Integer index;
    Integer mcfIndex;
    Opportunity clonedOppty;
    
    try {
        Set<String> fieldsToBeCloned = new Set<String>{'issuer_account__c','est_total_lien_leverage__c','investment_bank__c', 
                                                       'project_name__c', 'description', 'deal_category__c',
                                                       'accountid', 'classification__c', 'alternate_senior_leverage__c', 'alternate_total_leverage__c', 'junior_debt_pricing__c'};
      String objectName = 'Opportunity';
      String query = 'SELECT';
      String oppId = DealID;
            
      //be carefull here... you might hit heap size issues if there are too many fields on the object
      Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap();
           
      // Grab the fields from the describe method and append them to the queryString one by one.
      for(String s : objectFields.keySet()) {
        
        if (fieldsToBeCloned.contains(s)) //Only copy certain fields not all as per: T-550675
          query += ' ' + s + ',';
      }


      //strip off the last comma
      query = query.removeEnd (',');
            
      // Add FROM statement
      query += ' FROM ' + objectName;
            
      // Add on a WHERE/ORDER/LIMIT statement as needed
      query += ' WHERE ID = :oppId';
      Opportunity oldOppty = database.query(query);
      
      clonedOppty = oldOppty.clone(false, true, false, false);
      System.debug(clonedOppty.Id+'cloned Opty:'+clonedOppty);
    
        clonedOppty.OwnerId = UserInfo.getUserId();
         try {
          insert clonedOppty;
        } catch (DMLException ex) { 
          System.debug(ex.getMessage());
          return 'Error:'+ex.getMessage();
        }
         
        if (clonedOppty.ID != null) {
          
            List<Deal_Team__c> mcfDealTeam =  getMCFDealTeam(DealID);
            mcfDealTeam = mcfDealTeam.DeepClone(false,false,false);
            
            List<OpportunityTeamMember> opptyTeam = getOpportunityTeam(DealID);
            opptyTeam = opptyTeam.DeepClone(false,false,false);
            for (OpportunityTeamMember teamMember : opptyTeam) {
                iterationNumber = iterationNumber + 1;
                
                if(teamMember.TeamMemberRole == 'Originator 1'){
                  roleOriginator1 = true;
                  index = iterationNumber;
                }
                else{
                  teamMember.OpportunityID = clonedOppty.ID;
                }
                
            }
            System.debug('roleOriginator:'+roleOriginator1);
            System.debug('OTM1:'+opptyTeam);
            if(roleOriginator1){
              opptyTeam.remove(index);
              OpportunityTeamMember otm = new OpportunityTeamMember();
              otm.OpportunityID = clonedOppty.ID;
              otm.TeamMemberRole = 'Originator 1';
              otm.userId = UserInfo.getUserId();
              opptyTeam.add(otm);
              System.debug('OTM2:'+opptyTeam);
            }
            
            if(!roleOriginator1){
              
              OpportunityTeamMember otm = new OpportunityTeamMember();
              
              otm.OpportunityID = clonedOppty.ID;
              otm.TeamMemberRole = 'Originator 1';
              otm.userId = UserInfo.getUserId();
              
              opptyTeam.add(otm);
              System.debug('OTM3:'+opptyTeam);
            }
            
            
            try {
              insert opptyTeam;
              insert mcfDealTeam;
            } catch (DMLException ex) {
              System.debug('****1****'+ex.getMessage()+'*****Line Number:'+ex.getLineNumber());

              return 'Error:' + ex.getMessage();
            }
            
        }
     
      
    } catch (Exception e){
      System.debug('*****2***'+e.getMessage());
        return 'Error: ' + e.getMessage();
    }

    System.debug('****3****'+clonedOppty.ID);

    return clonedOppty.ID;
  }
  
Thanks
VRK
 
  • March 20, 2021
  • Like
  • 0
Hi 
I am creating  New Action Under 
Buttons, Links, and Actions 
for Lighting Component.

can some one help how to create below URL as Lighting Custom Component :

../{!$Label.Opportunity_NewButton_DealTeamObjectPrefix}/e?{!$Label.Opportunity_NewButton_DealTeamObject_OpportunityName_HTML_ElementId}={!Opportunity.Name}&{!$Label.Opportunity_NewButton_DealTeamObject_OpportunityNameLookup_HTML_ElementId}={!Opportunity.Id}&retURL={!Opportunity.Id}&saveURL={!Opportunity.Id}

Can anyone help on this.

Thanks
VRK
  • February 18, 2021
  • Like
  • 0
Hi 
Is it possible to send Email  with  Attachments to the Contact through Batch Apex.
lets explain little bit clear :
Test contact already have File 1 & File2.
So, 
I send to Send Email to ' Test Contact' along with  File1 & File2 ....through Batch Apex.

I am not sure, is it possible or not?
if possible, can some one provide any sample code for this requirment

Thanks
VRK

 
  • February 17, 2021
  • Like
  • 0




Custom links not appearing in ligthing

Hi folks,
I can able to see Custom inks in Classic version But unable to see in Lighitng Version.
All links are URL like below :

https://xxxx. salesforce.com/001/e?retURL=%2F001%2Fo&RecordType=01261000000WzE9&ent=Account

can some one help me how to show these Custom links in Lighting also...
if not possible , is there any way to display in Lighting ?
Thanks
VRK

  • February 17, 2021
  • Like
  • 0
Hi folks,
Below logic for 
When Deal Team records created, then same records created into Opp Team member records .
But , i required Logic AS :
If already records available in Opp Team Member , Then we can skip and create only new records
can any one helpme how to write logic for this :

global class BatchClass implements Database.Batchable<sobject>{
    
   Set<Id> dealIds = new Set<Id>();
   String sQuery;
   map<id, opportunity> mapOppIdRec = new map<id, opportunity>();
    // Start Method
    global Database.Querylocator start (Database.BatchableContext BC) {
        String sQuery;
       List<Deal_Team__c> listDealIds = [SELECT Name, Description, Deal__c FROM Deal_Team__c WHERE createdDate = yesterday];
       if (listDealIds.size()>0){
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c'; 
        }else {
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c where id=null';
        }
        return Database.getQueryLocator(sQuery);
    }
    
    // Execute method
    global void execute (Database.BatchableContext bc , List<Deal_Team__c> records){
        if (records.size()>0){
            List<OpportunityTeamMember> listToBeInserted = new List<OpportunityTeamMember>();           
            for (Deal_Team__c dealTeams : records){ 
            OpportunityTeamMember newOtm = new OpportunityTeamMember();
            newOtm.OpportunityId = dealTeams.Deal__c;
            //newOtm.CreatedBy = 'OpportunityTeamMember is created by' +userInfo.getUserId();
            listToBeInserted.add(newOtm);
            }         
            upsert listToBeInserted;     
        }
    }
 
    // Finish Method
    global void finish(Database.BatchableContext BC) {}
}
  • February 01, 2021
  • Like
  • 0
HI 
Email Tab under Activity is Missing in Sandbox, its available in Production.
I tried in add in Edit Lighting Record pages, But i can't .
This issue appears recently....
Any one idea how to fix this ?

User-added image
  • January 20, 2021
  • Like
  • 0

Hi
When upload attachements for Case Documnet Object getting View State Error .
Below scenario , getting View State Error:
Business tryng to upload PDF Documents more than 2 mb, getting this View State Error. 

When try to upload small size files more than 30+ also not getting this Error .
But, in our code we didn't mention anywhere File Size , pls let me know if required any modifications on below code :
VF Page :
---------

<apex:page docType="html-5.0" standardController="Case" extensions="CaseDocumentFileUploadCX" title="Upload Case document">
    <apex:includeScript value="{!URLFOR($Resource.jquery)}"  />
    <apex:form id="uploadForm">

    <script>
        var $jQuery = jQuery.noConflict();

        $jQuery(document).ready(function(){
            var $uploadNameInput = $jQuery('[id$="uploadFileName"]');
            //$uploadNameInput.prop('readonly', true);

            $jQuery('[id$="fileUploadInput"]').on('change', function(){
                var $this = $jQuery(this);
                $jQuery('[id$="documentLabel"]').val($this.val().split(/(\\|\/)/g).pop());
                //$uploadNameInput.prop('readonly', false);
                $uploadNameInput.val($this.val().split(/(\\|\/)/g).pop());
                //$uploadNameInput.prop('readonly', true);
                //refreshPage();
            });
            
            
        });
        
        </script>
        <script type="text/javascript">
        var caseDocId;
        var caseId = '{!caseId}';
        function evaluateCaseDoc() {
            $jQuery('#okuploadbtn').hide();
            $jQuery('#msg').text('Uploading');


            Visualforce.remoting.Manager.invokeAction(
                '{!$RemoteAction.CaseDocumentFileUploadCX.evaluate}',
                '{!jsonString}',
                '{!uploadFileName}',
                function(result1, event){
                    caseDocId = result1;
                    Visualforce.remoting.Manager.invokeAction(
                        '{!$RemoteAction.CaseDocumentFileUploadCX.executeRequest}',
                        result1,
                        function(result2, event){
                            $jQuery('#msg').text(result2);
                            if(result2 === 'Document Upload SUCCESSFUL!'){
                                $jQuery('#donebtn').show();
                            }else{
                                $jQuery('#retrybtn').show();
                            }
                        }, 
                        {escape: true}
                    );
            }, 
                {escape: true}
            );
        }
        
        </script>
        <!--<apex:actionFunction name="createCaseDoc" action="{!evaluate}" />-->
        <apex:actionFunction name="reupload" action="{!reupload}" />
        <apex:actionFunction name="loadCaseDoc" action="{!loadCaseDoc}" />
        <apex:outputPanel id="showstate"/>
        <apex:pageBlock id="filePageBlock" >
            <apex:pageMessages />
            <apex:pageBlockSection columns="1" title="File selection" id="fileSelection" >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="{!$ObjectType.CaseDocument__c.Fields.FilePath__c.Label}" />
                    <apex:inputFile value="{!fileUpload.body}" filename="{!fileUpload.name}" id="fileUploadInput" fileSize="{!caseDoc.FileSize__c}" contentType="{!caseDoc.MimeType__c}" style="width:100%;height:20px;" />
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock id="fileSelectionDetails" >
            <apex:pageBlockSection columns="1" title="File upload details">
                <apex:inputField value="{!caseDoc.Name}" label="{!$ObjectType.CaseDocument__c.Fields.Name.Label}" id="documentLabel" required="true" style="width:50%;" />
                <apex:inputText value="{!uploadFileName}" label="File name" id="uploadFileName" style="width:50%;" />
                <apex:inputField value="{!caseDoc.MimeType__c}"  rendered="false" label="{!$ObjectType.CaseDocument__c.Fields.MimeType__c.Label}" style="width:50%;"  />
                <apex:inputField value="{!caseDoc.BusinessCode__c}" style="width:50%;" />
                <apex:inputField value="{!caseDoc.CaseId__c}" label="{!$ObjectType.CaseDocument__c.Fields.CaseId__c.Label}" id="fileUploadCase" style="width:50%;"  />
            </apex:pageBlockSection>
            
            <apex:commandButton action="{!showCheckOpen}" value="Upload" />
        </apex:pageBlock>
        
        <apex:outputPanel id="showFileOpenPopUp">
          <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!showFileOpenPopUp}"/>
            <apex:outputPanel styleClass="custPopup overlayDialog cssDialog inlineEditDialog" style="display:block; visibility:visible;" layout="block" rendered="{!showFileOpenPopUp}">
              <div class="topRight">
                <div class="topLeft">
                  <h2></h2>
                </div>
              </div>
              <br />
              <apex:outputPanel id="msgLabelClass" rendered="{!showFileOpenPopUp}">
                  <div id="msg">{!$Label.CheckFileOpenDialogMessage}</div>
                  <br />
                  <br />
              </apex:outputPanel>                         
              <div class="buttons zen" style="margin-left: 100px; ">
                 <input id = "okuploadbtn" class="btn" width="20px" type="button" value="{!$Label.CheckFileOpenDialogOkButton}" onclick="evaluateCaseDoc();return false; "  />
                 <input id = "donebtn" style="display:none;" class="btn" width="20px" type="button" value="{!$Label.CheckFileOpenDialogOkButton}" onclick="window.open('/'+caseDocId,'_self');"  />
                <input id = "retrybtn" style="display:none;" class="btn" width="20px" type="button" value="{!$Label.CheckFileOpenDialogOkButton}" onclick="window.open('/apex/CaseDocumentFileUpload?id='+caseId,'_self');"  />
                </div>
            </apex:outputPanel>
        </apex:outputPanel>
                
    </apex:form>

    <style>

      [id$='msgLabelClass'] {
         display: inline;        
      }

      [id$='msgLabelClass'] > label {
         margin-left: 10px;
        block-width: 260px;
         display: inline-block;
      }

      [id$='msgLabelClass'] + table {
         margin-left: 10px;
         display: inline;
         vertical-align: middle;
         width: auto;
      }

      .custPopup{
         background-color: white;
         z-index: 100;
         left: 50%;
         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: 300px;
         height: 130px;
         margin-left: -250px;
         top:100px;
         padding-bottom: 15px;
      }

      .custPopup h2 {
                margin-right: 30px;
      }
      
      .popupBackground{
                background-color:black;
                opacity: 0.20;
                filter: alpha(opacity = 20);
                position: absolute;
                width: 100%;
                height: 100%;
                top: 0;
                left: 0;
                z-index: 99;
      }
    </style>    
</apex:page>

Apex class:
----------------
/**
 * @description Extension controller class for Case Document file upload functionality

 */
global with sharing class CaseDocumentFileUploadCX {
    public Document fileUpload {get;set;}
    public String uploadFileName {get;set;}
    public CaseDocument__c caseDoc {get;set;}
    public Case currentCase {get;set;}
    public Integer fileSize {get;set;}
    public String jsonString {get;set;}
    //19.JAN.2015 Yogesh Gupta, NYLIM  Added new Dialog
    public Boolean showFileOpenPopUp{get;set;}
    public String caseDocId {get;set;}
    public String caseId {get;set;}
    private boolean isSuccess;

    private static String injectHeader = ' DMS Document Maintenance (From Case Document)'; 
    private static String injectTempHeader = ' DMS Document Maintenance Temp (From Case Document)';
    private static Set<String> injectStates = new Set<String>{'5.4.a'};
    private static Set<String> injectTempStates = new Set<String>{'4.2.a','4.1.a','5.4.b'};
    

    global CaseDocumentFileUploadCX(ApexPages.StandardController controller) {
        currentCase = (Case) controller.getRecord();
        caseId  = currentCase.Id;
        fileUpload = new Document();
        uploadFileName = '';
        fileSize = 0;
        caseDoc = new CaseDocument__c();
        caseDoc.CaseId__c = currentCase.Id;
        caseDoc.MimeType__c = '';
        isSuccess = false;
    }

     @RemoteAction
    global static String evaluate(String jsonString, String uploadFileName ){
        PageReference newPage = null;
            
        System.debug('uploadFileName ::: ' + uploadFileName);
        String caseDocId;
         CaseDocument__c caseDoc = (CaseDocument__c) JSON.deserialize(jsonString, CaseDocument__c.class);
        //hideFileOpenPopUpPanel();
        if (uploadFileName != null && uploadFileName != '') {
            // Fetch file upload settings for the current user's profile
            FileUploadSettings__c fileUploadSettings = FileUploadSettings__c.getInstance(UserInfo.getProfileId());
            if (fileUploadSettings == null) {
                fileUploadSettings = FileUploadSettings__c.getOrgDefaults();
            }
            
            // Build the file path
            Id uid = UserInfo.getUserId();
            List<String> userFields = new List<String>{
                'Id',
                'FederationIdentifier'
            };
            String queryString = CS_UtilSObject.buildQuery(Schema.SObjectType.User, userFields);
            queryString += 'WHERE Id = :uid';
            User u = Database.query(queryString);
            //User u = [SELECT Id, FederationIdentifier FROM User WHERE Id = :uid];
            if (u != null) {
                caseDoc.FilePath__c = fileUploadSettings.get('NetworkFolderRootPath__c') + '\\' + u.FederationIdentifier + '\\' + uploadFileName;
            } else {
                ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'User not found');
                ApexPages.addMessage(errMsg);
            }
            
            try {
                CaseDocumentTrigger_Handler.runAfterInsert = false;
                CaseDocumentTrigger_Handler.runAfterUpdate = false;
                
                insert caseDoc;
                caseDocId = caseDoc.Id;
                System.debug('* ** *** insert ' + caseDocId);
                
                
                newPage = New PageReference('/apex/CaseDocumentFileUpload2?id=' + caseDoc.id);
                newPage.setRedirect(true);
            } catch (Exception e) {
                //ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.FATAL, e.getMessage());
                //ApexPages.addMessage(errMsg);
                System.debug('Error ::: ' + e);
            }
        } else {
            ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Please upload a document');
            ApexPages.addMessage(errMsg);
        }

        return caseDocId;
    }
    
    
    public PageReference showCheckOpen(){
        showFileOpenPopUp = true;
        jsonString = JSON.serialize(caseDoc);
        fileUpload = new Document();
        caseDoc = new CaseDocument__c();
        return null;
    }
    
    @RemoteAction
    global static String executeRequest(String caseDocId) {
            System.debug('* ** *** executeRequest');
            System.debug('* ** *** caseDocId ' + caseDocId);
            List<CaseDocument__c> caseDocList = [SELECT Id, IntegrationState__c, FilePath__c  FROM CaseDocument__c WHERE Id = :caseDocId LIMIT 1];
            if(caseDocList.isEmpty()){
                return 'UPLOAD FAILURE: An unexpected error has occured. Please try to upload document again. If you continue to experience difficulties, please contact your system administrator.';
            }
            
            CaseDocumentTrigger_Handler.runAfterInsert = false;
            CaseDocumentTrigger_Handler.runAfterUpdate = false;
            CaseDocumentTrigger_Handler.runBeforeUpdate = false;
                
            CaseDocument__c  caseDoc = caseDocList.get(0);
            if(injectStates.contains(caseDoc.IntegrationState__c)){
                if(!Test.isRunningTest()) CaseDocumentTrigger_Handler.executeRequests(new Set<String>{caseDoc.id},injectHeader,true); 
            }else{
                if(!Test.isRunningTest()) CaseDocumentTrigger_Handler.executeRequests(new Set<String>{caseDoc.id},injectTempHeader,true); 
            }
            
            PageReference newPage;
            caseDoc = [SELECT Id, CaseId__c, DMSInject_Code__c, DMSInject_Status__c FROM CaseDocument__c WHERE Id = :caseDocId];
            
            if(caseDoc.DMSInject_Status__c  == 'SUCCESS'){
                boolean isSuccess  = true;
                
                return 'Document Upload SUCCESSFUL!';
            }else{
                delete caseDoc;
                if(caseDoc.DMSInject_Code__c == '01'){
                    return 'DOCUMENT NOT FOUND: Please ensure that the document that you are trying to upload is located in the proper location and try again.';
                }else{
                    return 'UPLOAD FAILURE: An unexpected error has occured. Please try to upload document again. If you continue to experience difficulties, please contact your system administrator.';
                }
                
               
            }
            return 'UPLOAD FAILURE: An unexpected error has occured. Please try to upload document again. If you continue to experience difficulties, please contact your system administrator.';
            //return  New PageReference('/apex/CaseDocumentFileUpload2?id=' + caseDoc.id);

    }
   
   public PageReference reupload(){
        PageReference  newPage  =  New PageReference('/apex/CaseDocumentFileUpload?id=' + caseId);
        newPage.setRedirect(true);
        return newPage;  
    }
    
    public PageReference loadCaseDoc(){
        PageReference  newPage  = New PageReference('/' + caseDocId);
        
        newPage.setRedirect(true);
        return newPage;  
    }
    
    public PageReference showFileOpenPopUpPanel(){
        showFileOpenPopUp=True;
        return null;
    }

    public PageReference hideFileOpenPopUpPanel(){
        showFileOpenPopUp = False;
        return null;
    }   
}

Pls let me know any one have idea, how to fix View State error when upload large files for CaseDocumnet Object
Thanks
VRK

  • November 22, 2020
  • Like
  • 0
Hi pls l can et me know if anyone have idea on below points:

1. What is the difference between Salesforce IQ Inbox & salesforce Inbox?
ii. is it Licensed or Free ?

I need basic understandings, Pls don't share google stuff ....

Thannks
VRK
  • October 19, 2020
  • Like
  • 0
Hi 
let me know any Idea on below oncs:

1. Can we customize Standard Page Layouts without Using VF ?

Brief details :
I have Contact Object  and fiels like  firstName, lastName, phone,mobile,  Address1, Address2 ,Address 3.....
By using standard Page layout i created diffent sections like

Personal Information ( Section)
    firstName, lastName, phone
Contact details ( Section)
    Phone, landphone, mobile
Address ( Section)
    Address1, Address2 ,Address 3
    
Now the requirment is , My Business dont want Address as Section ...Instead of section , he wants to some thing different  Box Type or anyOther

I know ,By using Sections only we can divide Under Page Layouts.....
Do you have any idea, Without Using VF , can we go for Customize page layouts ?
************************************
2. Date format (EST) format issue When export data into CSV / Excel file?

Before export data , I updated Time Zone in below areas:
  1. Data loader 
  ii.User Time zone
  iii. System Time zone
 
 In Dataloader, When i query , Date format looks Correct
  2020-09-21 19:41:52
 But, when i export into CSV / Excel, the date format display as Below :
 2020-09-21T19:41:52.000Z

I tried, multiple ways , but its not working.
Any Idea on this?
  • October 08, 2020
  • Like
  • 0
Hi 
------------
Issue : Insufficinet access rights on cross-reference ID

Scenario : 
created process builder based on the Asset Object by follow critiria:

AND( AND( NOT ( ISPICKVAL([Asset].ADV_Classification__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Code__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Product__c,"") ), 
NOT ( ISPICKVAL([Asset].Executive_Summary__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Class__c,"") ) ,
ISPICKVAL( [Asset].Status, "onboarding") , 
OR( ISPICKVAL(PRIORVALUE([Asset].ADV_Classification__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Code__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Product__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Executive_Summary__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Class__c) , "") ) ) )

Immediate actions:
Create a Record
RecordType : Task
Assigned To ID  : Assign Task Queue
Related to ID   : {Asset.Id}

This issue is getting for only few profiles, But admin profiles not getting 

I verified, profile have proper access for Task , Asset and required fields

And this is happening after Winter 21 Refresh .................

Do you have any ideas ?

Thanks
VRK
-----------------------
  • October 01, 2020
  • Like
  • 0
Hi folks,
How to send email alert / notificaiton from Case object to '''SLA Custom object ---> Peer reviwer ''' through APex class.
Can you some one pls provide code for this requirement 
Thanks
Sekhar
 
  • November 07, 2019
  • Like
  • 1
scenario :   Case is created in Salesforce,  Immediatly this case details be moved to third patry systems ( .net system, java sysstem,.......)
how can i do this ?
example : 
case # 12345 created in salesforce, immediatly case reflected in third party systems like java ,.net or some other systems.
Due to project cost, not going for opiton use third party integration tools like Dell boomi......or any other tools.

please provide any ideas on this requirement 
Thanks 
  • May 18, 2018
  • Like
  • 1

Hi All,
When i run the test class, it covers only 50% not covering the  For loop condition , can you pls help me how to cover this :
User-added image
Apex class:
public class SortedLineItemsController {
public Opportunity opportunity { get; set; }
    
    public OpportunityLineItem[] getSorted() {
        if (opportunity == null || opportunity.opportunityLineItems== null) {
            return null;
        }
        
        // TODO: Add your sorting logic here (demo just reverses the list)
        OpportunityLineItem[] result = new OpportunityLineItem[1];
        for (OpportunityLineItem item : opportunity.opportunityLineItems) {
            result.add(0, item);
        }
        
        return result;
   }
}

Test class :

@isTest
public class SortedLineItemsController_Test {
    @isTest static void insertOpp() {
        Id pricebookId = Test.getStandardPricebookId();
        
        Test.startTest();
        // insert product
        Product2 p = new Product2();
        p.Name = ' Test Product ';
        p.Description='Test Product Entry For Product';
        p.productCode = 'SFDCPanther-123';
        p.isActive = true;
        insert p;
        
        // insert pricebook entry for the product
        PricebookEntry standardPrice = new PricebookEntry();
        standardPrice.Pricebook2Id = Test.getStandardPricebookId();
        standardPrice.Product2Id = p.Id;
        standardPrice.UnitPrice = 100;
        standardPrice.IsActive = true;
        standardPrice.UseStandardPrice = false;
        insert standardPrice ;
        
        Account testAccount1 = new Account();
        testAccount1.Name = 'Test Account 1';
        testAccount1.Industry__c    = 'Aerospace';
        insert testAccount1;
        
        Opportunity testOpportunity1 = new Opportunity();
        testOpportunity1.Name = 'Test Opportunity';
        testOpportunity1.AccountId = testAccount1.Id;
        testOpportunity1.StageName = '0 - Qualify Opportunity';
        testOpportunity1.Probability_2__c = '10%' ;
        testOpportunity1.CloseDate = system.today() + 10;
        testOpportunity1.Pricebook2Id = Test.getStandardPricebookId();
        
        insert testOpportunity1; 
        
        Opportunity testOpportunity2 = new Opportunity();
        testOpportunity2.Name = 'Test Opportunity';
        testOpportunity2.AccountId = testAccount1.Id;
        testOpportunity2.StageName = '0 - Qualify Opportunity';
        testOpportunity2.Probability_2__c = '10%' ;
        testOpportunity2.CloseDate = system.today() + 10;
        testOpportunity2.Pricebook2Id = Test.getStandardPricebookId();
        
        insert testOpportunity2; 
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem = new OpportunityLineItem();
        oppLineItem.OpportunityId = testOpportunity1.Id;
        oppLineItem.PricebookEntryId = standardPrice.Id;
        oppLineItem.UnitPrice = 7000.00;
        oppLineItem.Quantity = 5;
        oppLineItem.Amount_Updated__c = True;
        oppLineItem.Service_Percentage__c = 10;
        insert oppLineItem;
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem1 = new OpportunityLineItem();
        oppLineItem1.OpportunityId = testOpportunity2.Id;
        oppLineItem1.PricebookEntryId = standardPrice.Id;
        oppLineItem1.UnitPrice = 6000.25;
        oppLineItem1.Quantity = 5;
        oppLineItem1.Amount_Updated__c = True;
        oppLineItem1.Service_Percentage__c = 15;
        insert oppLineItem1;
        
        
        SortedLineItemsController slic = new SortedLineItemsController();
        List<OpportunityLineItem> slic_q = slic.getSorted();
        OpportunityLineItem[] slic_qli = slic.getSorted();
        OpportunityLineItem[] slic_qli1 = slic.getSorted(); 
        
        Test.stopTest();
    }
}

can you  pls check and let me know how to cover ...

Thanks in Advance

  • February 22, 2022
  • Like
  • 0
Hi folks,
we plan to migrate existing data from thousand to millions .
my approach here is :
i. i need to export data 
ii. convert thousand to millions in excel sheet
iii. update new data 

But i am in struck in convert data to Million ....i saw few articles in google, its not much clear .
exisitng field data type is (Currency(16, 1)
 
11434
1828786
960
14426
2862161
2056369
2342
 

can anyone help me to covert data to Millions ....in excel .

or if you have any best approaches pls suggest 
Thanks 
VRK
  • June 04, 2021
  • Like
  • 0
Hi Team,
I got one question from the interviewer that:
I have two users I want to show A user half of the fields of XYZ object and B wants to show remaining fields in the aura component, how we can achieve this.
 
Hi ..
HI i am created one formula field which fetch value of StageName( picklist ) value.
if picklist value select As 01 - Funded, the formula field updated As 01.
if picklist value select As 02 - Approved, the formula field updated As 02.
Below coding is working fine, But i need write Dynmic instead of pass static Values.
We have 100 picklist values, So is there any way to write logic as dynamic ..

IF(ISPICKVAL( StageName , "01 - Funded"), "01",
IF(ISPICKVAL( StageName , "02 - Approved"), "02",
IF(ISPICKVAL( StageName , "03 - Underwriting - In Process"), "03",
IF(ISPICKVAL( StageName , "04 - Term Sheet Issued/Pre-Underwriting"), "04", ""))))

Thanks
VRK
  • March 25, 2021
  • Like
  • 0
Hi folks,
Below logic for 
When Deal Team records created, then same records created into Opp Team member records .
But , i required Logic AS :
If already records available in Opp Team Member , Then we can skip and create only new records
can any one helpme how to write logic for this :

global class BatchClass implements Database.Batchable<sobject>{
    
   Set<Id> dealIds = new Set<Id>();
   String sQuery;
   map<id, opportunity> mapOppIdRec = new map<id, opportunity>();
    // Start Method
    global Database.Querylocator start (Database.BatchableContext BC) {
        String sQuery;
       List<Deal_Team__c> listDealIds = [SELECT Name, Description, Deal__c FROM Deal_Team__c WHERE createdDate = yesterday];
       if (listDealIds.size()>0){
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c'; 
        }else {
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c where id=null';
        }
        return Database.getQueryLocator(sQuery);
    }
    
    // Execute method
    global void execute (Database.BatchableContext bc , List<Deal_Team__c> records){
        if (records.size()>0){
            List<OpportunityTeamMember> listToBeInserted = new List<OpportunityTeamMember>();           
            for (Deal_Team__c dealTeams : records){ 
            OpportunityTeamMember newOtm = new OpportunityTeamMember();
            newOtm.OpportunityId = dealTeams.Deal__c;
            //newOtm.CreatedBy = 'OpportunityTeamMember is created by' +userInfo.getUserId();
            listToBeInserted.add(newOtm);
            }         
            upsert listToBeInserted;     
        }
    }
 
    // Finish Method
    global void finish(Database.BatchableContext BC) {}
}
  • February 01, 2021
  • Like
  • 0
Hi pls l can et me know if anyone have idea on below points:

1. What is the difference between Salesforce IQ Inbox & salesforce Inbox?
ii. is it Licensed or Free ?

I need basic understandings, Pls don't share google stuff ....

Thannks
VRK
  • October 19, 2020
  • Like
  • 0
Hi 
------------
Issue : Insufficinet access rights on cross-reference ID

Scenario : 
created process builder based on the Asset Object by follow critiria:

AND( AND( NOT ( ISPICKVAL([Asset].ADV_Classification__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Code__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Product__c,"") ), 
NOT ( ISPICKVAL([Asset].Executive_Summary__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Class__c,"") ) ,
ISPICKVAL( [Asset].Status, "onboarding") , 
OR( ISPICKVAL(PRIORVALUE([Asset].ADV_Classification__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Code__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Product__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Executive_Summary__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Class__c) , "") ) ) )

Immediate actions:
Create a Record
RecordType : Task
Assigned To ID  : Assign Task Queue
Related to ID   : {Asset.Id}

This issue is getting for only few profiles, But admin profiles not getting 

I verified, profile have proper access for Task , Asset and required fields

And this is happening after Winter 21 Refresh .................

Do you have any ideas ?

Thanks
VRK
-----------------------
  • October 01, 2020
  • Like
  • 0
Hi Team
My scenario :
For Test purpose , we configured Lightning Sync in Sandbox for User ( tesUser)  . its working fine .
Now , we configured in Prod for the same user 'testUser'.
its also working fine.
Now the problem is , User can able to both Sandbox & Production calender events his Outlook

So, we removed user from Sandbox, Now in sandbox, stopped getting new calender Syns.
But the problem, Old calender syns are still displaying even if we remove 'testUser ' in lighting sync configuration related to Sandbox

can you pls let me know , how can we remove old user's calender Syncs related to Sandbox ?

Thanks
VRK
 
  • August 26, 2020
  • Like
  • 0
Hi 
Scenario : when i create new Task / Event , then phone number field value populate from related to Contact Object Phone field.
For example :
I have Contact ' Test Contact ' and phone number is '99999999'.
When i create any Task /  Event, then Test Contact phone number is display as '99999999'.

Thanks
VRK
  • August 23, 2020
  • Like
  • 0

Hi I have few questions on Einstein activity capture , pls let me know if anyone have idea / Suggest for better solutions :

My requirement :
------------------------------

Calender Sync Salesforce ( bi-direction)
        &&
Task Sync ( bi-direction)

my analysis :
-------------
Lightning Sync :
---- After Dec 2020 , its depreciated and Salesforce suggested go for 'Einstein Actvity Capture'
My questions are ??
i. Is Einstein supports both Calender Sync & Tasks Sync
Note : I am sure, its support for Calender Sync But not sure for Tasks Sync

2. 
License = Sales Cloud Einstein --> Permission Set = Sales Cloud Einstein  
License = Inbox --> Permission Set = Inbox with Einstein Activity Capture
License = Sales Cloud --> Permission Set = Standard Einstein Activity Capture
Any one idea, which License supports for my requirement ? and is this License free or Cost ?

3. Do you have any other Suggestions for Tasks Sync ?
Pls treat this is little bit urget...
Thanks
VRK

  • August 04, 2020
  • Like
  • 0
Hi all,
pls find my requirment below :

Required to  create http get from complex json  &   cast http response with apex.class of the json
if anyone have scenarios / code pls share

Thanks
VRK
 
  • July 09, 2020
  • Like
  • 0

Hi
How to Fetch only '"Contract Release' in below JSON Data :::

data->
        [{"Date_Reviewed":"1989-05-06","Date_Sent":"1989-05-05","editable":true,"Form":"Contract Revision 1","Id":"a0S3F000001bXAIUA2"},
        {"Date_Reviewed":"2019-02-01","Date_Sent":"2019-02-01","editable":true,"Form":"Contract Revision 2","Id":"a0S3F000001bXAJUA2"},
        {"Date_Reviewed":"2020-12-27","editable":true,"Form":"Contract Revision 3","Id":"a0S3F000001bXAKUA2"},
        {"Date_Reviewed":"2020-01-03","Date_Sent":"2020-01-03","editable":true,"Form":"Contract Release","Id":"a0S3F000001bXALUA2"},
        {"Date_Reviewed":"2020-12-29","editable":true,"Form":"Contract Revision 4","Id":"a0S3F000001bXAMUA2"},
        {"Date_Reviewed":"2020-12-30","editable":true,"Form":"Contract Revision 5","Id":"a0S3F000001bXANUA2"},
]        

My code :
saveDataTable :function(component, event) {
var data = component.get("v.data"); 
 var editedRecords1 =  component.find("riderStatusDataTable").get("v.draftValues");
for (var x in data)
            {
              var d = data[x];
 if(d.Form == "Contract Release" ){
  TemporaryArray1.Date_Sent__c = editedRecords1[0].Date_Sent;
           TemporaryArray1.Date_Reviewed__c = editedRecords1[0].Date_Reviewed;
break;
}
But , this is not Restrict for Contract Release ........its applied for all the Forms . I need this is for only 'Contract Release'...
can anyone help me...
Thanks
VRK
  • June 26, 2020
  • Like
  • 0