• PARISE RAVIKIRAN
  • NEWBIE
  • 20 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 3
    Replies
The above fields must be updated every time when any of the actions mentioned in the below document has been performed on either Account Plan or a related record:
1.Last Updated Date/Time: When the event/action has taken place
2.Last Updated By: User who performed the action
3.Last Updated Section: Which component of the account plan has been updated (refer to the below document for the Account Plan Section details)
 
Account Plan SectionFieldAction 
Account Profile - OutlineAccount Plan NameEdited
Account Profile - OutlinePrimary IndustriesEdited
Account Profile - OutlineWhat do they offer?Edited
Account Profile - OutlineWho are their customers?Edited
Account Profile - OutlineAnnual RevenueEdited
   
   
  Edited
These above are data when ever a field is updated or inserted these  fields should display
1.Last Updated Date/Time: When the event/action has taken place
2.Last Updated By: User who performed the action
3.Last Updated Section: Which component of the account plan has been updated (refer to the below document for the Account Plan Section details)  and in this Last Updated Section: it should display last Last Updated Section name.
give me best solutions.
sp.actionItems = [
            SELECT Customer_Objective__r.Objective_Name__c, Priority__c, Due_Date__c, Subject__c, Assigned_To__r.Name, Status__c
            FROM Action_Item__c
            WHERE
                Success_Plan__c = :successPlanId
                AND Status__c IN :SUC_Constants.ACTION_ITEM_STATUS_SET
                AND Internal_External__c = :SUC_Constants.ACTION_ITEM_INT_EXT_EXT
            ORDER BY Customer_Objective__r.Objective_Name__c
        ];

How to write That Status__c not equal Closed.
i am facing these errors while running pull request in developer org.Can any ony help me how to slove this.User-added imageplease check the above image.

html file:
<template>
   <lightning-card title="Create Account Record" class="slds-align_absolute-center">
    <div class="slds-m-around_medium">
      <lightning-record-edit-form object-api-name={objectApiName} onsuccess={handleSuccess}>
         <lightning-input-field field-name="Name" required></lightning-input-field>
         <lightning-input-field field-name="BillingStreet"></lightning-input-field>
         <lightning-input-field field-name="BillingCity"></lightning-input-field>
         <lightning-input-field field-name="BillingState"></lightning-input-field>
         <lightning-input-field field-name="BillingPostalCode"></lightning-input-field>
         <lightning-input-field field-name="BillingCountry"></lightning-input-field>
         <lightning-input-field field-name="AccountSource" required></lightning-input-field>
         <lightning-input-field field-name="AnnualRevenue" required></lightning-input-field>
         <lightning-input-field field-name="Website"></lightning-input-field>
         <lightning-button variant="brand" label="Save" title="save" type="submit" onclick={handleSuccess}></lightning-button>
         &nbsp; &nbsp;
         <lightning-button variant="brand" label="Cancel" title="cancel" onclick={handleCancel}></lightning-button>
</lightning-record-edit-form>
</div>
   </lightning-card>
   
</template>

Js.file:
import { LightningElement,track } from 'lwc';
import { CloseActionScreenEvent } from 'lightning/actions';
import { createRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import BILLINGSTREET_FIELD from '@salesforce/schema/Account.BillingStreet';
import BILLINGCITY_FIELD from '@salesforce/schema/Account.BillingCity';
import ACCOUNTSOURCE_FIELD from '@salesforce/schema/Account.AccountSource';
import REVENUE_FIELD from '@salesforce/schema/Account.AnnualRevenue';
import WEBSITE_FIELD from '@salesforce/schema/Account.Website';
export default class QuickAccount extends LightningElement {
   
    firstName = '';
    annualRevenue = '';
    accountSource = '';
    website = '';
    billingStreet = '';
    billingCity = '';
    industry = '';
   
   
    handleFirstNameChange(event) {
        this.accountId = undefined;
        this.firstName = event.target.value;
    }
    handleAnnualRevenueChange(event){
        this.annualRevenue=event.target.value;
    }
    handleAccountSourceChange(event){
        this.accountSource=event.target.value;
    }
    handleWebsiteChange(event){
        this.website=event.target.value;
    }
    handleBillingStreetChange(event){
        this.billingStreet=event.target.value;
    }
    handleBillingCityChange(event){
        this.billingCity=event.target.value;
    }
    handleIndustryChange(event){
        this.industry=event.target.value;
    }
    closeAction(){
        this.dispatchEvent(new CloseActionScreenEvent());
    }
   
   
    createAccount() {
        const fields = {}
        fields[NAME_FIELD.fieldApiName] = this.firstName;
        fields[BILLINGSTREET_FIELD.fieldApiName] = this.billingStreet;
        fields[BILLINGCITY_FIELD.fieldApiName] = this.billingCity;
        fields[REVENUE_FIELD.fieldApiName] = this.annualRevenue;
        fields[ACCOUNTSOURCE_FIELD.fieldApiName] = this.accountSource;
        fields[WEBSITE_FIELD.fieldApiName] = this.website;
       
        const recordInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };
        createRecord(recordInput)
            .then(account => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Account created',
                        variant: 'success',
                    }),
                );
            })
            .catch(error => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error creating record',
                        message: error.body.message,
                        variant: 'error',
                    }),
                );
            });
    }
   
}

i am expecting below type:
User-added image


but i am getting  below  for account source :
User-added image

 
html file:
<template>
   <lightning-card title="Create Account Record" class="slds-align_absolute-center">
    <div class="slds-m-around_medium">
      <lightning-record-edit-form object-api-name={objectApiName} onsuccess={handleSuccess}>
         <lightning-input-field field-name="Name" required></lightning-input-field>
         <lightning-input-field field-name="BillingStreet"></lightning-input-field>
         <lightning-input-field field-name="BillingCity"></lightning-input-field>
         <lightning-input-field field-name="BillingState"></lightning-input-field>
         <lightning-input-field field-name="BillingPostalCode"></lightning-input-field>
         <lightning-input-field field-name="BillingCountry"></lightning-input-field>
         <lightning-input-field field-name="AccountSource" required></lightning-input-field>
         <lightning-input-field field-name="AnnualRevenue" required></lightning-input-field>
         <lightning-input-field field-name="Website"></lightning-input-field>
         <lightning-button variant="brand" label="Save" title="save" type="submit" onclick={handleSuccess}></lightning-button>
         &nbsp; &nbsp;
         <lightning-button variant="brand" label="Cancel" title="cancel" onclick={handleCancel}></lightning-button>
</lightning-record-edit-form>
</div>
   </lightning-card>
   
</template>

Js.file:
import { LightningElement,track } from 'lwc';
import { CloseActionScreenEvent } from 'lightning/actions';
import { createRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import BILLINGSTREET_FIELD from '@salesforce/schema/Account.BillingStreet';
import BILLINGCITY_FIELD from '@salesforce/schema/Account.BillingCity';
import ACCOUNTSOURCE_FIELD from '@salesforce/schema/Account.AccountSource';
import REVENUE_FIELD from '@salesforce/schema/Account.AnnualRevenue';
import WEBSITE_FIELD from '@salesforce/schema/Account.Website';
export default class QuickAccount extends LightningElement {
   
    firstName = '';
    annualRevenue = '';
    accountSource = '';
    website = '';
    billingStreet = '';
    billingCity = '';
    industry = '';
   
   
    handleFirstNameChange(event) {
        this.accountId = undefined;
        this.firstName = event.target.value;
    }
    handleAnnualRevenueChange(event){
        this.annualRevenue=event.target.value;
    }
    handleAccountSourceChange(event){
        this.accountSource=event.target.value;
    }
    handleWebsiteChange(event){
        this.website=event.target.value;
    }
    handleBillingStreetChange(event){
        this.billingStreet=event.target.value;
    }
    handleBillingCityChange(event){
        this.billingCity=event.target.value;
    }
    handleIndustryChange(event){
        this.industry=event.target.value;
    }
    closeAction(){
        this.dispatchEvent(new CloseActionScreenEvent());
    }
   
   
    createAccount() {
        const fields = {}
        fields[NAME_FIELD.fieldApiName] = this.firstName;
        fields[BILLINGSTREET_FIELD.fieldApiName] = this.billingStreet;
        fields[BILLINGCITY_FIELD.fieldApiName] = this.billingCity;
        fields[REVENUE_FIELD.fieldApiName] = this.annualRevenue;
        fields[ACCOUNTSOURCE_FIELD.fieldApiName] = this.accountSource;
        fields[WEBSITE_FIELD.fieldApiName] = this.website;
       
        const recordInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };
        createRecord(recordInput)
            .then(account => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Account created',
                        variant: 'success',
                    }),
                );
            })
            .catch(error => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error creating record',
                        message: error.body.message,
                        variant: 'error',
                    }),
                );
            });
    }
   
}

i am expecting below type:
User-added image
but i am getting  below  for account source .
User-added image
 static testMethod void testsetLeadSourceforPartnerGeneratedLeads(){
    
        Id RecordTypeIdLeadDirect = Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Direct').getRecordTypeId();
        List<Lead> leadCreateList = new List<Lead>();
        List<LeadShare> leadShareList = new List<LeadShare>();
        Test.startTest();
        Lead testLead = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        leadCreateList.add(testLead);
        
        Lead testLead2 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        testLead2.email = 'testemailduplicate@partner.com';
        testLead2.RecordTypeId = RecordTypeIdLeadDirect;
        testLead2.Status = '1-New'; 
        leadCreateList.add(testLead2);
        
        Lead testLead3 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
        testLead3.Country = 'United States';
        testLead3.State = 'GA'; 
        leadCreateList.add(testLead3);
        
        insert leadCreateList;
        
        User partnerUser = [Select id from User where email = 'puser000@testlead.com'];
        
        LeadShare ldShare = new LeadShare(LeadId = testLead.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare);
        
        LeadShare ldShare2 = new LeadShare(LeadId = testLead3.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare2);
        
        insert leadShareList;
        
        System.runAs(partnerUser){
            Lead newLeadRec = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
            newLeadRec.Country = 'United States';
            newLeadRec.State = 'GA';
            newLeadRec.LeadSource = 'Partner';
            newLeadRec.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            insert newLeadRec;
            
            Lead updateLead2 = [Select id, email from Lead where id =: testLead3.Id];
            updateLead2.email = 'testemailduplicate@partner.com';
            updateLead2.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            try{
                LeadTriggerControl.executeBeforeUpdate = true;
                update updateLead2;
            }
            catch(Exception excep){
                Boolean expectedExceptionThrown =  excep.getMessage().contains('Please submit your Leads to DocuSign as') ? true : false;
                //System.AssertEquals(expectedExceptionThrown, true, excep);
            }
        }
        Test.stopTest();
    }
    

    /*************************************************************
     * Method Name  : testsetLeadSourceforPartnerGeneratedLeads
     * Description  : Test Method for the setLeadSourceforPartnerGeneratedLeads() and createCampaignMembersForPartnerLeads() function in LeadTriggerUtilityCls.cls
     * Return Type  : n/a
     * Parameters   : none
     **************************************************************/
    static testMethod void testsetLeadSourceforPartnerGeneratedLeads(){
    
        Id RecordTypeIdLeadDirect = Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Direct').getRecordTypeId();
        List<Lead> leadCreateList = new List<Lead>();
        List<LeadShare> leadShareList = new List<LeadShare>();
        Test.startTest();
        Lead testLead = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        leadCreateList.add(testLead);
        
        Lead testLead2 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        testLead2.email = 'testemailduplicate@partner.com';
        testLead2.RecordTypeId = RecordTypeIdLeadDirect;
        testLead2.Status = '1-New'; 
        leadCreateList.add(testLead2);
        
        Lead testLead3 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
        testLead3.Country = 'United States';
        testLead3.State = 'GA'; 
        leadCreateList.add(testLead3);
        
        insert leadCreateList;
        
        User partnerUser = [Select id from User where email = 'puser000@testlead.com'];
        
        LeadShare ldShare = new LeadShare(LeadId = testLead.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare);
        
        LeadShare ldShare2 = new LeadShare(LeadId = testLead3.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare2);
        
        insert leadShareList;
        
        System.runAs(partnerUser){
            Lead newLeadRec = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
            newLeadRec.Country = 'United States';
            newLeadRec.State = 'GA';
            newLeadRec.LeadSource = 'Partner';
            newLeadRec.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            insert newLeadRec;
            
            Lead updateLead2 = [Select id, email from Lead where id =: testLead3.Id];
            updateLead2.email = 'testemailduplicate@partner.com';
            updateLead2.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            try{
                LeadTriggerControl.executeBeforeUpdate = true;
                update updateLead2;
            }
            catch(Exception excep){
                Boolean expectedExceptionThrown =  excep.getMessage().contains('Please submit your Leads to DocuSign as') ? true : false;
                //System.AssertEquals(expectedExceptionThrown, true, excep);
            }
        }
        Test.stopTest();
    }
    
 static testMethod void testsetLeadSourceforPartnerGeneratedLeads(){
    
        Id RecordTypeIdLeadDirect = Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Direct').getRecordTypeId();
        List<Lead> leadCreateList = new List<Lead>();
        List<LeadShare> leadShareList = new List<LeadShare>();
        Test.startTest();
        Lead testLead = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        leadCreateList.add(testLead);
        
        Lead testLead2 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        testLead2.email = 'testemailduplicate@partner.com';
        testLead2.RecordTypeId = RecordTypeIdLeadDirect;
        testLead2.Status = '1-New'; 
        leadCreateList.add(testLead2);
        
        List<Lead> testLead3 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
        testLead3.Country = 'United States';
        testLead3.State = 'GA'; 
        leadCreateList.add(testLead3);
        
        insert leadCreateList;
        
        User partnerUser = [Select id from User where email = 'puser000@testlead.com'];
        
        LeadShare ldShare = new LeadShare(LeadId = testLead.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare);
        
        LeadShare ldShare2 = new LeadShare(LeadId = testLead3.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare2);
        
        insert leadShareList;
        
        System.runAs(partnerUser){
            Lead newLeadRec = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
            newLeadRec.Country = 'United States';
            newLeadRec.State = 'GA';
            newLeadRec.LeadSource = 'Partner';
            newLeadRec.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            insert newLeadRec;
            
            Lead updateLead2 = [Select id, email from Lead where id =: testLead3.Id];
            updateLead2.email = 'testemailduplicate@partner.com';
            updateLead2.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            try{
                LeadTriggerControl.executeBeforeUpdate = true;
                update updateLead2;
            }
            catch(Exception excep){
                Boolean expectedExceptionThrown =  excep.getMessage().contains('Please submit your Leads to DocuSign as') ? true : false;
                //System.AssertEquals(expectedExceptionThrown, true, excep);
            }
        }
        Test.stopTest();
    }
    
    @isTest
    static void updateDuplicateLeadsForScoreAndOptOutInsTest(){
        User elqIntUser = [Select Id from User where username = :Label.Eloqua_Integration_User_Name limit 1];
        
        Test.startTest();
        System.runAs(elqIntUser) {
            Lead sfdcLead6 = CreateLead('John', 'Lead 3', OptInOptOutScore, 'Docusign', 'United States');
            sfdcLead6.Enagement_Score__c = 10;
            sfdcLead6.Profile_Score__c = 5;
            sfdcLead6.Hard_Opt_In__c = true;
            LeadTriggerControl.executeAfterUpdate = true;
            Database.DMLOptions dml3 = new Database.DMLOptions();
            dml3.DuplicateRuleHeader.AllowSave = true;
            Database.SaveResult sr3 = Database.insert(sfdcLead6, dml3);
        }
        Test.stopTest();

        Lead[] leads = GetLeadsByEmail(OptInOptOutScore);
        System.assertEquals(3, leads.size(), leads.size());

        for (Lead l : leads) {
            system.assertEquals(true, l.Hard_Opt_In__c);
            system.assertEquals(10, l.Enagement_Score__c);
            system.assertEquals(5, l.Profile_Score__c);
        }

        Contact[] contacts = GetContactsByEmail(OptInOptOutScore);
        System.assertEquals(1, contacts.size(), contacts.size());

        for (Contact c : contacts) {
            System.assertEquals(false, c.Outreach_Opt_Out__c);
            System.assertEquals(LeadToOpportunityUtilityCls.CONSENTED, c.Email_Consent_Status__c);
            System.assertEquals(true, c.Hard_Opt_In__c);
        }
    }
    
@isTest
    static void updateDuplicateLeadsForScoreAndOptOutInsTest(){
        User elqIntUser = [Select Id from User where username = :Label.Eloqua_Integration_User_Name limit 1];
        
        Test.startTest();
        System.runAs(elqIntUser) {
            Lead sfdcLead6 = CreateLead('John', 'Lead 3', OptInOptOutScore, 'Docusign', 'United States');
            sfdcLead6.Enagement_Score__c = 10;
            sfdcLead6.Profile_Score__c = 5;
            sfdcLead6.Hard_Opt_In__c = true;
            LeadTriggerControl.executeAfterUpdate = true;
            Database.DMLOptions dml3 = new Database.DMLOptions();
            dml3.DuplicateRuleHeader.AllowSave = true;
            Database.SaveResult sr3 = Database.insert(sfdcLead6, dml3);
        }
        Test.stopTest();

        Lead[] leads = GetLeadsByEmail(OptInOptOutScore);
        System.assertEquals(3, leads.size(), leads.size());

        for (Lead l : leads) {
            system.assertEquals(true, l.Hard_Opt_In__c);
            system.assertEquals(10, l.Enagement_Score__c);
            system.assertEquals(5, l.Profile_Score__c);

        }
 @isTest
    static void duplicateLeadOptInInsertEloquaUser() {
        User elqIntUser = [Select Id from User where username = :Label.Eloqua_Integration_User_Name limit 1];
        
Test.startTest();
        System.runAs(elqIntUser) {
            Lead sfdcLead2 = CreateLead('John', 'duplicateLeadOptInInsertEloquauser', notOptInOrOut, 'Docusign', 'United States');
            sfdcLead2.HasOptedOutOfEmail = false;
            sfdcLead2.Hard_Opt_In__c = true;
            LeadTriggerControl.executeAfterUpdate = true;
            Database.DMLOptions dml2 = new Database.DMLOptions();
            dml2.DuplicateRuleHeader.AllowSave = true;
            Database.SaveResult sr2 = Database.insert(sfdcLead2, dml2);

            Lead l1 = GetLeadById(sfdcLead2.Id);
            System.assertEquals(false, l1.Outreach_Opt_Out__c);
            System.assertEquals(LeadToOpportunityUtilityCls.CONSENTED, l1.Email_Consent_Status__c);
        }
static void assignPartnerLeadsResellTest() {
        User aPartnerUser = [
            SELECT Id, UserName, ProfileId, Profile.Name, ContactId, Contact.Name, Contact.AccountId 
            FROM User 
            WHERE Email = 'puser000@testlead.com'
        ];
 
static void leadInsertOptIn() {
        String email = 'dummy.rand.Opt.In@email.321.org';
        Test.startTest();
        Lead sfdcLead1 = CreateLead('John', 'leadInsertOptIn', email, 'Docusign', 'United States');
        sfdcLead1.HasOptedOutOfEmail = false;
        sfdcLead1.Hard_Opt_In__c = true;
        insert sfdcLead1;
        Test.stopTest();

        Lead l = GetLeadById(sfdcLead1.Id);
        System.assertEquals(false, l.HasOptedOutOfEmail);
        System.assertEquals(true, l.Hard_Opt_In__c);
        System.assertEquals(false, l.Outreach_Opt_Out__c);
        System.assertEquals(LeadToOpportunityUtilityCls.CONSENTED, l.Email_Consent_Status__c);
    }
 
i am facing these errors while running pull request in developer org.Can any ony help me how to slove this.User-added imageplease check the above image.
 @isTest
    static void duplicateLeadOptInInsertEloquaUser() {
        User elqIntUser = [Select Id from User where username = :Label.Eloqua_Integration_User_Name limit 1];
        
Test.startTest();
        System.runAs(elqIntUser) {
            Lead sfdcLead2 = CreateLead('John', 'duplicateLeadOptInInsertEloquauser', notOptInOrOut, 'Docusign', 'United States');
            sfdcLead2.HasOptedOutOfEmail = false;
            sfdcLead2.Hard_Opt_In__c = true;
            LeadTriggerControl.executeAfterUpdate = true;
            Database.DMLOptions dml2 = new Database.DMLOptions();
            dml2.DuplicateRuleHeader.AllowSave = true;
            Database.SaveResult sr2 = Database.insert(sfdcLead2, dml2);

            Lead l1 = GetLeadById(sfdcLead2.Id);
            System.assertEquals(false, l1.Outreach_Opt_Out__c);
            System.assertEquals(LeadToOpportunityUtilityCls.CONSENTED, l1.Email_Consent_Status__c);
        }