• ravi soni
  • PRO
  • 3450 Points
  • Member since 2020
  • Developer
  • MODV India Private Ltd


  • Chatter
    Feed
  • 110
    Best Answers
  • 0
    Likes Received
  • 4
    Likes Given
  • 1
    Questions
  • 497
    Replies

Hi Connections,
I am getting below error while retrieve data from vs code. can somebody please help me out to resolve this issue. I got this error first time.

here is error
INSUFFICIENT_ACCESS: use of the Metadata API requires a user with the ModifyAllData or ModifyMetadata permissions.

Thanks in advance

Hi Friends,
is there any way for fetching data/records from lightning flow and show in custom table in lwc?
I tried but didn't succeed.can you please give me any example or guide that how can we achieve this?

I believe you guys help me.
Thanks  in advance
 
Hi folks,
I have one requirment I want a custom datatable with inline editing in lwc.
can you please provide me any reference.
Thanks in advance

 
Hi,

In LWC, there is a way to automatically update the content in it when the record is updated without having to refresh the page. This is possible if we use getRecordNotifyChange.

My question is how do we detect a change in the related list in a custom LWC? For example, when I delete a file from the Files related list, I see the spinner appear on each of the standard related lists meaning that they are getting automatically refreshed when I delete the related file. So, how do I get a custom LWC also to refresh itself when a related record or atleast a related file is deleted?
I have some code in my Apex class that basically says:

    public PageReference redirect(){
        
        String somekey = [SELECT Key__c FROM Some_metadata__mdt WHERE Organization_Id__c = :runningOrg.Id].Destination_Key__c;    
        
    String URL='https://myurl.com/' + someKey + '?accId='+Account_Id__c.Id+'&sourceId='Source_Record_Id__c.Source+'&svcType='+Service_Type__c.Service+'&rsrcId='+Event_Id__c;
        PageReference getFeedback=new PageReference(URL);
        getFeedback.setRedirect(true);
        return getFeedback;

I have written the test code as such:

    @istest
    static void TestPageRedirect(){
        String somekey = 'UsFZNSFf';
        String URL='https://myurl.com/' + surveyKey + '?accId=123456789&sourceId=123456789&svcType=My Service Type&rsrcId=My Event ID';
        PageReference getFeedback=new PageReference(URL);
        Test.setCurrentPage(getFeedback);

The test executes without problems but none of the code in the Apex class is shown as covered.

What am I doing wrong?
I am trying not to use (SeeAllData=true), but when I don't use it the test returns no data. When I try to insert data into the record I get an error message that the field cannot be written.

Is there a way around this?
Line: 22, Column: 1
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [First_Name__c, Last_Name__c]: [First_Name__c, Last_Name__c]

Hi All

I have tried to create multiselect picklist dropdown through LWC but here values are hardcoded. You can see my Code Below:

Demo.html

<template>
    <!-- picklistlabel sets the label to multi select combobox -->
   
    <c-mutli-select-picklist picklistlabel="Industry" values={values} ></c-mutli-select-picklist>
</template>

demo.js

import { LightningElement, track, api } from 'lwc';
export default class Demo extends LightningElement {
    //This array can be anything as per values
    values =    [{label : 'Agriculture', value : 'Agriculture', selected : false},
                {label : 'Banking', value : 'Banking', selected : false},
                {label : 'Chemicals', value : 'Chemicals'},
                {label : 'Education', value : 'Education'},
                {label : 'Finance', value : 'Finance'}];
               
    //To get the picklist values in container component
    fetchSelectedValues(){
        let selections = this.template.querySelector('c-mutli-select-picklist');
        console.log(selections.values);
    }
}

Demo.js meta

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__HomePage</target>
      </targets>
</LightningComponentBundle>

 

Requirement: 

Object: Account and Field: Industry

I want that through apex class all the picklist value of industry would be visible in dropdown instead of hardcoded value.

Can anybody help me to make it dynamic.

Thanks in Advance

Hi,

I'm new to LWC.
How do I change the button color and size of a lightning-button? It's taking the default from "Variant".

Alternatively, can I use anything else (like icon)?

Any help in this regard is really appreciated.
My requirement is to hide & show text field based on picklist values selected on lead object can anyone suggest the best way
Hi guys, for some reason my test class says Pass in the Developer Console but code coverage is 0% at the same time. How can it pass the test if there is 0%? I only used a test class generator because I'm not good at creating test classess yet.

Here is my custom controller:
public class ContactTasks{
    public Event event;
    public ContactTasks() {
        event = [SELECT FIELDS(STANDARD) FROM Event WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }
    public Event getEvent(){
        return event;
    }
    List <Task> relatedTasks;
        public List<Task> getrelatedTasks(){
        relatedTasks = [SELECT FIELDS(STANDARD)
                FROM Task
                WHERE WhoId= :this.event.WhoId
                ORDER BY ActivityDate DESC];
        return relatedTasks;
    }

    
}
Here is my test class:
@isTest
private class ContactTasks_Test{
  @testSetup
  static void setupTestData(){
    test.startTest();
    Contact contact_Obj = new Contact(LastName='Test');
    Insert contact_Obj;
    Event eventobj = new Event(WhoId = contact_Obj.id, DurationInMinutes = 10, ActivityDateTime = Datetime.now());
    Insert eventobj;
    Task task_Obj = new Task(WhoId = contact_Obj.id, ActivityDate = Date.today(), Status = 'Not Started', Priority = 'High', Description = '12', IsReminderSet = false, IsRecurrence = false, Placeholder_for_next_call_set__c = false, BD_Meeting_scheduled_by_InMail__c = false, Duplicate_Meeting__c = false, Automatic_Reply__c = false, Candidate_InMail__c = false, Bounced__c = false);
    Insert task_Obj; 
    test.stopTest();
  }
  static testMethod void test_getEvent_UseCase1(){
    List<Task> task_Obj  =  [SELECT Id,WhoId,WhatId,WhoCount,WhatCount,Subject,ActivityDate,Status,Priority,Description,IsRecurrence,Placeholder_for_next_call_set__c from Task];
    System.assertEquals(true,task_Obj.size()>0);
    PageReference pageRef = Page.ContactsTasks;
    pageRef.getParameters().put('id','test');
    Test.setCurrentPage(pageRef);
    Contact contact_Obj = new Contact(LastName='Test');
    Insert contact_Obj;
    Event eventobj = new Event(WhoId = contact_Obj.id, DurationInMinutes = 10, ActivityDateTime = Datetime.now());
    Insert eventobj;

  }

    static testMethod void test_getEvent_UseCase3(){
    List<Task> task_Obj  =  [SELECT Id,WhoId,WhatId,WhoCount,WhatCount,Subject,ActivityDate,Status,Priority,Description,IsRecurrence,Placeholder_for_next_call_set__c from Task];
    System.assertEquals(true,task_Obj.size()>0);
    PageReference pageRef = Page.ContactsTasks;
    pageRef.getParameters().put('id','test');
    Test.setCurrentPage(pageRef);


    task_Obj[0].ActivityDate = date.parse('7/13/2022');
    task_Obj[0].Status='Not Started';
    task_Obj[0].Priority='High';
    task_Obj[0].Description = '0';

  }
  static testMethod void test_getrelatedTasks_UseCase1(){
    List<Task> task_Obj  =  [SELECT Id,WhoId,WhatId,WhoCount,WhatCount,Subject,ActivityDate,Status,Priority,Description,IsRecurrence,Placeholder_for_next_call_set__c from Task];
    System.assertEquals(true,task_Obj.size()>0);
    PageReference pageRef = Page.ContactsTasks;
    pageRef.getParameters().put('id','test');
    Test.setCurrentPage(pageRef);

  }

    static testMethod void test_getrelatedTasks_UseCase2(){
    List<Task> task_Obj  =  [SELECT Id,WhoId,WhatId,WhoCount,WhatCount,Subject,ActivityDate,Status,Priority,Description,IsRecurrence,Placeholder_for_next_call_set__c from Task];
    System.assertEquals(true,task_Obj.size()>0);
    PageReference pageRef = Page.ContactsTasks;
    pageRef.getParameters().put('id','test');
    Test.setCurrentPage(pageRef);


    task_Obj[0].ActivityDate = date.parse('7/13/2022');
    task_Obj[0].Status='Not Started';
    task_Obj[0].Priority='High';
    task_Obj[0].Description = '0';

  }
}
Using map in trigger. If account has more than one contact it should display like this. abc@gmail.com,xyz@gmail.com.
Hello There, I'm trying to fetch records from Case object but it showing error as - No such column 'Contact' on entity 'Case'

my query is - 
Select id, Status, Account.Name from Case where Contact IN ('Forbes, Sean', 'Pavlova, Stella')
can anyone plz suggest if any mistake
Hello There, I have created batch class for Lead object, it's working but I  want to add try-catch block in that, it showing error when I placed these blocks, I'm not able to figure out right place to write these block maybe. can anyone plz help in this.

//this is my code

global class BatchDemo_Lead implements Database.Batchable<sObject>{
    try{
    global Database.QueryLocator start(Database.BatchableContext bc){
        return Database.getQueryLocator([Select id from Lead]);
    }
        
    }
    
    global void execute(Database.BatchableContext bc, List<Lead> scope){
        
        for(Lead l : scope)
        {
            if(l.State == 'VA'){
            l.State = 'NJ';
        }
        }
        update scope;
        }
    
    global void finish(Database.BatchableContext bc){
        system.debug('Batch process finished.');
    }
    catch(Exception e){
           return Database.getQueryLocator(Select id, State from Lead);
            System.debug('DML operation executed from catch block');
    }
    }
    
Hello,

I am getting 'Review the errors on this page.
You must select a sales campaign to perform a status change.
' error that seems like a validation rule but when I make a QUERY in Validation Rule I don't find any with this error message.

Can this be created in any other way? Is there any way to debug it or find where this is coming through?

I made a Debug Log with Finest and Info in Validation but I don't see anything there either.

Thank you!

User-added image