• Annu Choudhary
  • NEWBIE
  • 100 Points
  • Member since 2018

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 10
    Likes Given
  • 0
    Questions
  • 19
    Replies
Hi Friends,
I was trying a test code to insert 50,000 records using the below code, its throwing the limit exception related to dml rows of 10000 reached.

My question is since I specified  false as below
Database.SaveResult[] srList = Database.insert(lstContacts, false);
is this code suppose to insert at least 10000 records, but did'nt do it.

Let me know your comments.


My code below
List<Contact> lstContacts = new List<Contact>();
for(Integer x = 0; x<50000; x++ ){
    Contact con = new Contact(LastName= 'Keller'+x, FirstName='Helen'+x);
    lstContacts.add(con);
}
Database.SaveResult[] srList = Database.insert(lstContacts, false);

for (Database.SaveResult sr : srList) {
    if (sr.isSuccess()) {
        // Operation was successful, so get the ID of the record that was processed
        System.debug('Successfully inserted account. Account ID: ' + sr.getId());
    }
    else {
        // Operation failed, so get all errors                
        for(Database.Error err : sr.getErrors()) {
            System.debug('The following error has occurred.');                    
            System.debug(err.getStatusCode() + ': ' + err.getMessage());
            System.debug('Account fields that affected this error: ' + err.getFields());
        }
    }
}

Thanks
JG
 
Hii Friends,
I want code for upsert records
I have oject Timesheet__c custom object.
Which has following filed.
Name
Month__c(Master_detail with Month__c object)
Resource__c(Lookup with Resource__c object)

i want code for if the Timesheet for that Month is already exist then update that records if not then create new record.
this is my code
Timesheet__c ts=new Timesheet__c();
                    ts.Month__c=new_records3.Id;
                    ts.Resource__c=currentRecord.Resource__c;
                    List<Timesheet__c> tlist=new List<Timesheet__c>();
                    tlist=[SELECT ID,Name,Month__r.Name,Resource__r.Name 
                           FROM Timesheet__c
                           WHERE Month__r.Name=: new_records3.Name AND Resource__r.Name=:currentRecord.Resource__r.Name];
                    if(tlist.size()>0){
                        for(Timesheet__c t:tlist){
                            update ts t.ID;
                        }
                        
                    }
                    else
                        insert ts;

Above not updating existing records.It creating new records.
Please help me as soon as possible. Its very urgent
Thanks in advance
Hi All,
     I had a LWC component which simply update an child (contact) record using Inline Edit. I am getting this error : Uncaught (in promise) TypeError: Cannot read property 'message' of undefined at eval (lwc_utils.js:4). I am using this LWC component Account record detail page to display associate child (contact) records. Please any one guide me how to fix this issue. 

Unable to edit this record using inline edit. Got this error
Error
Apex Class: ContactController
----------------------------------------- 
public with sharing class ContactController {
    @AuraEnabled(Cacheable = true)
    public static List<Contact> getRecords(String recordId) {        
       return [SELECT Name, Email,Phone,Maximum__c,Minimum__c FROM Contact WHERE AccountId =: recordId];
    }

    @AuraEnabled
    public static void saveContacts(List<Contact> conList){
        Insert conList;        
    } 
}
Java Script: 
----------------
import { LightningElement, track, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import CONTACT_OBJECT from '@salesforce/schema/Contact';
import ID_FIELD from '@salesforce/schema/Contact.Id';
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import PHONE_FIELD from '@salesforce/schema/Contact.Phone';
import MAX_FIELD from '@salesforce/schema/Contact.Maximum__c';
import MIN_FIELD from '@salesforce/schema/Contact.Minimum__c';
import getRecords from '@salesforce/apex/ContactController.getRecords';
import saveContacts from '@salesforce/apex/ContactController.saveContacts';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import { refreshApex } from '@salesforce/apex';
import { updateRecord } from 'lightning/uiRecordApi';

const columns = [
    { label: 'Name', fieldName: 'Name' , type: 'Text', editable: true},
    { label: 'Email', fieldName: 'Email', type: 'Email', editable: true },
    { label: 'Phone', fieldName: 'Phone', type: 'Phone', editable: true },
    { label: 'Maximum', fieldName: 'Maximum__c', type: 'number', editable: true },
    { label: 'Minimum', fieldName: 'Minimum__c', type: 'number', editable: true },
];

export default class DatatableBasic extends NavigationMixin(LightningElement) {
@api recordId;
@track data;
@track contactList = [];
@track draftValues = []; 
@track firstName = FIRSTNAME_FIELD;
@track lastName = LASTNAME_FIELD;
@track email = EMAIL_FIELD;
@track phone = PHONE_FIELD;
@track max = MAX_FIELD;
@track min = MIN_FIELD;
@track columns = columns;
@track tableLoadingState = true;
@track noRecordsFound = true;
error;
wiredDataResult;

con = {
    FirstName : this.firstName,
    LastName : this.lastName,
    Email : this.email,
    Phone : this.phone,
    AccountId : this.recordId,
    Maximum__c : this.max,
    Minimum__c : this.min,
    key : ''
}

concCellChange(event){
    console.log(event.detail);
}

handleSave(event) {

    const fields = {};
    fields[ID_FIELD.fieldApiName] = event.detail.draftValues[0].Id;
    fields[FIRSTNAME_FIELD.fieldApiName] = event.detail.draftValues[0].FirstName;
    fields[LASTNAME_FIELD.fieldApiName] = event.detail.draftValues[0].LastName;
    fields[EMAIL_FIELD.fieldApiName] = event.detail.draftValues[0].Email;
    fields[PHONE_FIELD.fieldApiName] = event.detail.draftValues[0].Phone;
    fields[MAX_FIELD.fieldApiName] = event.detail.draftValues[0].Maximum__c;
    fields[MIN_FIELD.fieldApiName] = event.detail.draftValues[0].Minimum__c;

    const recordInput = {fields};

    updateRecord(recordInput)
    .then(() => {
        this.dispatchEvent(
            new ShowToastEvent({
                title: 'Success',
                message: 'Contact updated',
                variant: 'success'
            })
        );
        // Clear all draft values
        this.draftValues = [];
        // Display fresh data in the datatable
        return refreshApex(this.recordInput);
    })
    .catch(error => {
        this.message = undefined;
        this.error = error;
        this.dispatchEvent(
            new ShowToastEvent({
                title: 'Error creating record',
                message: error.body.message,
                variant: 'error'
            })
        );
        console.log("error", JSON.stringify(this.error));
    });
}

@wire(getRecords , { recordId: '$recordId' })  
    wiredRecordsMethod(result) {
        this.wiredDataResult = result;
        if (result.data) {
            this.data = result.data;
            this.error = undefined;
            if(this.data.length > 0){
                this.noRecordsFound = false;
            }
            else{
                this.noRecordsFound = true;
            }
   
        } else if (result.error) {
            this.error = result.error;
            this.data = undefined;
        }        
    }
}
HTML:
---------
<template>
    <lightning-card title="Contacts" icon-name="standard:Contact" > <br/>
        <div style="width: auto;">
            <template if:true={data}>   
            <div class="slds-p-around_medium lgc-bg" style="height: 300px;">
                <lightning-datatable
                        key-field="id"
                        data={data}
                        columns={columns}
                        show-row-number-column="true"
                        hide-checkbox-column="true"
                        oncellchange={concCellChange}
                        onsave={handleSave}
                        draft-values={draftValues} >
                </lightning-datatable>
                <template if:true= {noRecordsFound}>
                    --No Contact Records Found--
                </template>
            </div>  
            </template>
            
        </div>
    </lightning-card>   
</template>

Thanks
Siva

 
Hi Friends,
I was trying a test code to insert 50,000 records using the below code, its throwing the limit exception related to dml rows of 10000 reached.

My question is since I specified  false as below
Database.SaveResult[] srList = Database.insert(lstContacts, false);
is this code suppose to insert at least 10000 records, but did'nt do it.

Let me know your comments.


My code below
List<Contact> lstContacts = new List<Contact>();
for(Integer x = 0; x<50000; x++ ){
    Contact con = new Contact(LastName= 'Keller'+x, FirstName='Helen'+x);
    lstContacts.add(con);
}
Database.SaveResult[] srList = Database.insert(lstContacts, false);

for (Database.SaveResult sr : srList) {
    if (sr.isSuccess()) {
        // Operation was successful, so get the ID of the record that was processed
        System.debug('Successfully inserted account. Account ID: ' + sr.getId());
    }
    else {
        // Operation failed, so get all errors                
        for(Database.Error err : sr.getErrors()) {
            System.debug('The following error has occurred.');                    
            System.debug(err.getStatusCode() + ': ' + err.getMessage());
            System.debug('Account fields that affected this error: ' + err.getFields());
        }
    }
}

Thanks
JG
 
Hii Friends,
I want code for upsert records
I have oject Timesheet__c custom object.
Which has following filed.
Name
Month__c(Master_detail with Month__c object)
Resource__c(Lookup with Resource__c object)

i want code for if the Timesheet for that Month is already exist then update that records if not then create new record.
this is my code
Timesheet__c ts=new Timesheet__c();
                    ts.Month__c=new_records3.Id;
                    ts.Resource__c=currentRecord.Resource__c;
                    List<Timesheet__c> tlist=new List<Timesheet__c>();
                    tlist=[SELECT ID,Name,Month__r.Name,Resource__r.Name 
                           FROM Timesheet__c
                           WHERE Month__r.Name=: new_records3.Name AND Resource__r.Name=:currentRecord.Resource__r.Name];
                    if(tlist.size()>0){
                        for(Timesheet__c t:tlist){
                            update ts t.ID;
                        }
                        
                    }
                    else
                        insert ts;

Above not updating existing records.It creating new records.
Please help me as soon as possible. Its very urgent
Thanks in advance
Hi All,
     I had a LWC component which simply update an child (contact) record using Inline Edit. I am getting this error : Uncaught (in promise) TypeError: Cannot read property 'message' of undefined at eval (lwc_utils.js:4). I am using this LWC component Account record detail page to display associate child (contact) records. Please any one guide me how to fix this issue. 

Unable to edit this record using inline edit. Got this error
Error
Apex Class: ContactController
----------------------------------------- 
public with sharing class ContactController {
    @AuraEnabled(Cacheable = true)
    public static List<Contact> getRecords(String recordId) {        
       return [SELECT Name, Email,Phone,Maximum__c,Minimum__c FROM Contact WHERE AccountId =: recordId];
    }

    @AuraEnabled
    public static void saveContacts(List<Contact> conList){
        Insert conList;        
    } 
}
Java Script: 
----------------
import { LightningElement, track, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import CONTACT_OBJECT from '@salesforce/schema/Contact';
import ID_FIELD from '@salesforce/schema/Contact.Id';
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import PHONE_FIELD from '@salesforce/schema/Contact.Phone';
import MAX_FIELD from '@salesforce/schema/Contact.Maximum__c';
import MIN_FIELD from '@salesforce/schema/Contact.Minimum__c';
import getRecords from '@salesforce/apex/ContactController.getRecords';
import saveContacts from '@salesforce/apex/ContactController.saveContacts';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import { refreshApex } from '@salesforce/apex';
import { updateRecord } from 'lightning/uiRecordApi';

const columns = [
    { label: 'Name', fieldName: 'Name' , type: 'Text', editable: true},
    { label: 'Email', fieldName: 'Email', type: 'Email', editable: true },
    { label: 'Phone', fieldName: 'Phone', type: 'Phone', editable: true },
    { label: 'Maximum', fieldName: 'Maximum__c', type: 'number', editable: true },
    { label: 'Minimum', fieldName: 'Minimum__c', type: 'number', editable: true },
];

export default class DatatableBasic extends NavigationMixin(LightningElement) {
@api recordId;
@track data;
@track contactList = [];
@track draftValues = []; 
@track firstName = FIRSTNAME_FIELD;
@track lastName = LASTNAME_FIELD;
@track email = EMAIL_FIELD;
@track phone = PHONE_FIELD;
@track max = MAX_FIELD;
@track min = MIN_FIELD;
@track columns = columns;
@track tableLoadingState = true;
@track noRecordsFound = true;
error;
wiredDataResult;

con = {
    FirstName : this.firstName,
    LastName : this.lastName,
    Email : this.email,
    Phone : this.phone,
    AccountId : this.recordId,
    Maximum__c : this.max,
    Minimum__c : this.min,
    key : ''
}

concCellChange(event){
    console.log(event.detail);
}

handleSave(event) {

    const fields = {};
    fields[ID_FIELD.fieldApiName] = event.detail.draftValues[0].Id;
    fields[FIRSTNAME_FIELD.fieldApiName] = event.detail.draftValues[0].FirstName;
    fields[LASTNAME_FIELD.fieldApiName] = event.detail.draftValues[0].LastName;
    fields[EMAIL_FIELD.fieldApiName] = event.detail.draftValues[0].Email;
    fields[PHONE_FIELD.fieldApiName] = event.detail.draftValues[0].Phone;
    fields[MAX_FIELD.fieldApiName] = event.detail.draftValues[0].Maximum__c;
    fields[MIN_FIELD.fieldApiName] = event.detail.draftValues[0].Minimum__c;

    const recordInput = {fields};

    updateRecord(recordInput)
    .then(() => {
        this.dispatchEvent(
            new ShowToastEvent({
                title: 'Success',
                message: 'Contact updated',
                variant: 'success'
            })
        );
        // Clear all draft values
        this.draftValues = [];
        // Display fresh data in the datatable
        return refreshApex(this.recordInput);
    })
    .catch(error => {
        this.message = undefined;
        this.error = error;
        this.dispatchEvent(
            new ShowToastEvent({
                title: 'Error creating record',
                message: error.body.message,
                variant: 'error'
            })
        );
        console.log("error", JSON.stringify(this.error));
    });
}

@wire(getRecords , { recordId: '$recordId' })  
    wiredRecordsMethod(result) {
        this.wiredDataResult = result;
        if (result.data) {
            this.data = result.data;
            this.error = undefined;
            if(this.data.length > 0){
                this.noRecordsFound = false;
            }
            else{
                this.noRecordsFound = true;
            }
   
        } else if (result.error) {
            this.error = result.error;
            this.data = undefined;
        }        
    }
}
HTML:
---------
<template>
    <lightning-card title="Contacts" icon-name="standard:Contact" > <br/>
        <div style="width: auto;">
            <template if:true={data}>   
            <div class="slds-p-around_medium lgc-bg" style="height: 300px;">
                <lightning-datatable
                        key-field="id"
                        data={data}
                        columns={columns}
                        show-row-number-column="true"
                        hide-checkbox-column="true"
                        oncellchange={concCellChange}
                        onsave={handleSave}
                        draft-values={draftValues} >
                </lightning-datatable>
                <template if:true= {noRecordsFound}>
                    --No Contact Records Found--
                </template>
            </div>  
            </template>
            
        </div>
    </lightning-card>   
</template>

Thanks
Siva

 
Toast message works when i work from standalone LEX component, however when i save the record from the lightningApp the toast messages are not getting fire.

I know there is a limitation since we can not fire toast events from classic and app, 

I am looking out for an workaround here. Appreciate your help


Below is my controller.
onSave : function (component, event, helper) {
        helper.saveRec(component, event, helper);
    },
Helper :
 
saveRec:function(component, event, helper) {
        var gbmObj= component.get("v.newGBMPlan");
        var action = component.get("c.creatGBMRecord");
        if(component.get("v.recId")=="new")
        {
            action.setParams({
                "gbm": gbmObj ,
                "recId":component.get("v.recId"),
                
            });
        }
        else
        {
            action.setParams({
                "gbm": gbmObj ,
                "recId":component.get("v.recId"),
                
            });
        }
        action.setCallback(this,function(response){
            if (response.getState() === "SUCCESS") {
                //alert("Record Created/Updated Successfully");
                //window.close();
                
               // var toastEvent = $A.get("e.force:showToast");
              
                  helper.showToast({
                    title: "Record Created/Updated Successfully",
                    message: " ",
                    type: "success"
                });
             //toastEvent.fire();

Lightning App
<aura:application extends="force:slds" access="GLOBAL" >
    <aura:dependency resource="markup://force:showToast" type="EVENT"></aura:dependency>
	 <c:SC_Plans/>
  </aura:application>


 
  • February 26, 2020
  • Like
  • 0
Hi,
On Event object there are two fileds StartDateTime and EndDateTime,
on the aura component (not on the controller) how can i check that enddatetime of the event is greater than the startdatetime by 2 days.
then i want ot display Multiday event.
Thanks
Hi...! need to generate the salesforce simple json....i had embeded a page in the other page.. and trying to generate the json .. 

Page:1:
<apex:page controller="controllertest1">
  <apex:form >
   Enter Name:<apex:inputText value="{!statedet.stateName}"/>
  </apex:form>
</apex:page>
Page:2  : called page1 in page2
<apex:page controller="controllertest1">
 <apex:include pageName="testpage1"/>
  <br/>
  <apex:form >
   <apex:commandButton value="JSON GENERATOR"  action="{!genereatejson}" reRender="tm" />
  <br/>
   <apex:outputLabel id="tm"> {!jsonstrng}</apex:outputLabel>
  </apex:form>
</apex:page>

Commoncontroller:
public class controllertest1{
   public statedetails statedet{get;set;}
   public string jsonstrng{get;set;}
   public  controllertest1(){
     string  teststring= ' { "sucess":1,"data": {"stateName": "Andrapradesh",  "value": "apx" ,"rating":5 } } ';
     Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(teststring);
     Object ob = (Object)maptest.get('data');
     String srlze  = System.JSON.serialize(ob);
     statedet= (statedetails)System.JSON.deserialize(srlze,statedetails .class);
    }
 public void genereatejson(){
          JSONGenerator gen = JSON.createGenerator(true);
          gen.writeStartObject();
          gen.writeStringField('stateName',statedet.stateName);
          gen.writeEndObject();
          jsonstrng = gen.getasString();
   }
      //wrapperclass
       public  class statedetails{
       public string stateName{get;set;}
       public string value{get;set;}
       public integer rating{get;set;}
       }
}

Note: After editing the input and clicking on the Button, iam not getting the changed  dynamic format . 
thanks 
deepika
 
Here is what i have done...
Messaging.SendEmailResult[] results;
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setToAddresses(new String[] {ldOwnerMail});
message.setTemplateId([select id from EmailTemplate where DeveloperName='LeadsNewassignmentnotificationSAMPLE'].id);
message.setTargetObjectId(lead.OwnerId);

message.setSaveAsActivity(false);
results = Messaging.sendEmail(new Messaging.SingleEmailMessage[]{message});
How to pass recordId here so Emailtemplate can take it and show further details (Name,Company).


Template is look alike is--
** NEW LEAD STATUS CHANGE NOTIFICATION ***

The following lead's status has been changed.

Lead Name: {!Lead.Name}

Company: {!Lead.Company}

Here is the Lead Detail: {!Lead.Link}

 
Here is my code for a separate section and a column.I need to 2 two columns as i have many field to show on that section of layout.
Can anyone help how to divide a section in two columns by apex.I am using Metadata API currently.
if(layout.layoutSections==null)
            layout.layoutSections = new List<MetadataService.LayoutSection>();
        MetadataService.LayoutSection newLayoutSection = new MetadataService.LayoutSection();
        newLayoutSection.customLabel = true;
        newLayoutSection.detailHeading = true;
        newLayoutSection.editHeading = true;
        newLayoutSection.label = 'Keyword fields';
        newLayoutSection.style = 'TwoColumnsLeftToRight';}

 
hi ,

I have to create google chart from apex class and insert the chart into attachement.

Thanks.
I have to take input in vf page using html tag <input type> then capitalize the input and display it in another vf page. How should I approach?
Hi i'm lost in a test for a send email, i need to test if the email as sent, how i do that?

Thanks for your attention

Batch Class:
global class EmailCaringSenior implements Schedulable, Database.Batchable<sObject> {
    
    Account estipulante;
    
	global Database.QueryLocator start(Database.BatchableContext BC) {
        try{
        	estipulante = [SELECT Id FROM Account WHERE RecordTypeId IN (SELECT Id FROM RecordType WHERE Name = 'Estipulante' AND SObjectType = 'Account') AND Name = 'Caring Senior'];
        } catch(Exception e) {
             System.debug('The following exception has occurred: ' + e.getMessage());
        }
        return Database.getQueryLocator([SELECT Name, CPF__pc FROM Account WHERE Estipulante__c = :estipulante.Id AND CreatedDate = TODAY]);
	}
    
   	global void execute(Database.BatchableContext BC, List<sObject> scope) {
		List<Account> accounts = (List<Account>) scope;
        String listaPaciente = '';
        Integer contagem = 0;
		for(Account paciente : accounts){
			contagem++;
            listaPaciente +=  contagem + '. ' + paciente.Name + ' (CPF: ' + paciente.CPF__pc + ') <br>';
		}
        
		String dataOntem = DateTime.now().addDays(-1).format('dd-MM-yyyy');
        
		Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.toAddresses = new String[] { 'gabrielmocelin@unochapeco.edu.br' };
        message.subject = 'Ace - Novos Pacientes (' + dataOntem +  ')';
        message.setHtmlBody('Olá Gestor, <br> Abaixo uma lista de pacientes carregados no Health Cloud ontem (' + dataOntem + '): <br><br> ' + listaPaciente);
        for(OrgWideEmailAddress owa : [SELECT Id, Address, DisplayName FROM OrgWideEmailAddress]) 
        {
           if(owa.DisplayName.contains('Caring Senior'))
           { 
            message.setOrgWideEmailAddressId(owa.Id); 
           } 
        }
        Messaging.SingleEmailMessage[] messages =   new List<Messaging.SingleEmailMessage> {message};
        Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);
        
        if (results[0].success) 
        {
            System.debug('The email was sent successfully.');
        } else 
        {
            System.debug('The email failed to send: ' + results[0].errors[0].message);
        }
    }

	global void execute(SchedulableContext sc) {
		EmailCaringSenior b = new EmailCaringSenior();
		Database.executebatch(b);
	}
	
	global void finish(Database.BatchableContext BC) {
		
	}
}
Test Class:
@isTest
public class Test_EmailCaringSenior {
    
    static testMethod void testInsertDetecta()
    {   
        Integer contasAntes = [SELECT COUNT() FROM Account];
        System.assertEquals(contasAntes, 0);
        
        RecordType estipulanteRecordType = [SELECT Id FROM RecordType WHERE Name = 'Estipulante' AND SObjectType = 'Account'];
        Account estipulante = new Account();
        estipulante.RecordTypeId = estipulanteRecordType.Id;             
        estipulante.Name = 'Caring Senior';
        insert estipulante;
        
        Datetime dataAnteOntem = Datetime.now().addDays(-2);
        Test.setCreatedDate(estipulante.Id, dataAnteOntem);
 
        RecordType personAccountRecordType = [SELECT Id FROM RecordType WHERE Name = 'Paciente' AND SObjectType = 'Account'];
        Account paciente = new Account();
        paciente.RecordType = personAccountRecordType;             
        paciente.FirstName = 'Teste';
        paciente.LastName = 'Sobrenome';
        paciente.CPF__pc = '133.173.513-06';
        paciente.Estipulante__c = estipulante.id;
        insert paciente;
        
        Datetime dataOntem = Datetime.now().addDays(-1);
        Test.setCreatedDate(paciente.Id, dataOntem);

        Test.startTest();
			Account myAccount = [SELECT Id, Name, CreatedDate FROM Account WHERE Name ='Teste Sobrenome' LIMIT 1];
        	System.assertEquals(myAccount.CreatedDate, dataOntem);	
      		
           	Account estipulanteTest = [SELECT Id, CreatedDate FROM Account WHERE Name = 'Caring Senior' AND RecordTypeId = :estipulanteRecordType.Id];
			System.assertEquals(estipulanteTest.Id, estipulante.id);
        	System.assertEquals(estipulanteTest.CreatedDate, dataAnteOntem);
        
            EmailCaringSenior b = new EmailCaringSenior();
			Database.executebatch(b);
        
        Test.stopTest();
    }
}

 
Here is my code for a separate section and a column.I need to 2 two columns as i have many field to show on that section of layout.
Can anyone help how to divide a section in two columns by apex.I am using Metadata API currently.
if(layout.layoutSections==null)
            layout.layoutSections = new List<MetadataService.LayoutSection>();
        MetadataService.LayoutSection newLayoutSection = new MetadataService.LayoutSection();
        newLayoutSection.customLabel = true;
        newLayoutSection.detailHeading = true;
        newLayoutSection.editHeading = true;
        newLayoutSection.label = 'Keyword fields';
        newLayoutSection.style = 'TwoColumnsLeftToRight';}

 
For me if I go to settings it is showing like below how to create a namespace there is no edit 

Please check below image help me how I can create it 
User-added image
There is no Edit option that is what is showing for me in my org account
While implementing emp API in LWC to subscribe the platform event I  find out that there is small issue in sample code snipit given in documentation.
Issue is in handleSubscribe method in js below is the code given in documentation:
handleSubscribe() {
        // Callback invoked whenever a new event message is received
        const messageCallback = function(response) {
            console.log('New message received : ', JSON.stringify(response));
            // Response contains the payload of the new message received
        };

        // Invoke subscribe method of empApi. Pass reference to messageCallback
        subscribe(this.channelName, -1, messageCallback).then(response => {
            // Response contains the subscription information on successful subscribe call
            console.log('Successfully subscribed to : ', JSON.stringify(response.channel));
            this.subscription = response;
            this.toggleSubscribeButton(true);
        });
    }
 Correction is required in messageCallback method which should be as below:
const messageCallback = (response) => {
        console.log('New message received : ', JSON.stringify(response));
        this.payload = JSON.stringify(response);
        console.log('this.payload: ' + this.payload);
        // Response contains the payload of the new message received
    };
We have to use arrow function as it does not have its own scope.  
Hi guys,

I followed Emp API (https://developer.salesforce.com/docs/component-library/bundle/lightning-emp-api/documentation), and it works in lightning experence.
But it doesn't work when I embedded it in a vf page.

I have used <apex:includeLightning />, and debuged into subscribe function. No error, and nothing happens.
I have two lightning components. One for create new record and other one for edit record. I am overriding the standard new and edit actions with these components. 

The new action is working fine and user is getting redirected to CreateComponent which is firing standard e.force:CreateRecord event and the form shows up correctly.

However when I am trying to edit the record it is being redirected to EditComponent but then the browser hangs. On debugging I found that it is causing an infinite loop because of the standard e.force:EditRecord event being called in js controller for the component which seems to be logically correct.

But my question is why it is not behaving the same for CreateComponent. What is the difference between the two? or Am I missing something here?
In Aura, we can do
$A.get('e.force:refreshView').fire();
to cause standard components to update.

How can we do an equivalent in LWC because sfdx refuses to publish .js code with $A in it saying the usage is disallowed in LWC?

For now i tricked it with 
eval("$A.get('e.force:refreshView').fire();");
but that is obviously less than ideal....
We have opportunity record types based on products selected and the page layout changes by record types. On product update, i am using Process builder + flow to check the related products and update the matching record type. Classic used to update the record type and load the record page with record type matched layout. Lightning does not load automatically and users have to manually refresh the page to see the revised page layout. Is there a way to enfore full page refresh when the record type is updated through flow?
Hi everybody|
I have a requirement to display canvasapp in Home page Lightning. Now I tried to create component and used it in appbuilder Home page but not visible canvasapp.

I'm following the documtation found at https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_add_cmp_salesforce1.htm , but even with the 'implements="force:appHostable"' set in my aura:component, the Lightning Component isn't available when I try to add a new Lightning Tab.

Any insight?