Forum Replies Created

  • Prafull

    Member
    October 31, 2021 at 3:48 am in reply to: Need help with syntex

    Hi yash,

    You can convert set to list or list to set. In your scenario you're assigning all the values of set to newly created list.

    For more information follow below article

    https://www.biswajeetsamal.com/blog/convert-list-to-set-and-set-to-list-in-apex/

    https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm

  • Prafull

    Member
    October 24, 2021 at 4:00 pm in reply to: Need help with syntex

    Hi yash,
    In Apex Map<Id,SObject_ApI_Name> will take each record of entered sobject api name by making id as unique key field.
    So in your code you're inserting a list of opportunities, after that adding that list into map means you're making map of opportunities with id as unique field.
    Now map keySet method returns set of id as uniqness feature of map in Apex.
    In Apex map have unique key with dupliy values. You can also use map.values() method to take list of records.
    For more info follow below offical document.
    https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_map.htm

  • Prafull

    Member
    September 26, 2021 at 10:58 am in reply to: Generating leads and automated emails

    Hi Henrieta,

    You can make use of Process Builder/Flow to send email when lead is created with source web.
    If you want to add attachment then you need invoke an apex action that have id of uploaded file as pdf.

    Please refer below links
    Sending an email with attachment using Process Builder in Salesforce. | LinkedIn

    Create Web to Lead form in Salesforce – Jitendra Zaa's Blog

  • Prafull

    Member
    August 18, 2021 at 3:19 pm in reply to: reset Salesforce password

    Check spam and bin folder on email or check email address in trailblazer account.<div></div><div>If any of above thing doesn't help then try to get your org id and raise a case on salesforce support they will help you to get back your org.</div>

  • No, But you can make read only field that will be updated their value according to trigger or lightning flows with sum calculations (Average, Sum, count).

  • Prafull

    Member
    August 8, 2021 at 6:26 am in reply to: role

    Requirement:-
    Hierarchy Manager (Profile = Manager) (Create, Update & Delete the Assign Object Record)
    |---> Team lead (Create, Update for Assign Object) (See their own record and high priority assign object record)
    |---> Executive team lead (Create, Update for Assign Object) (See their own record)

    Solution:-
    You want to apply both object level & record level security on Assign Object
    For Object Level Security, we firstly need to restrict the access means only providing create, update in the
    Profile Manager --> Making a permission set in which we're providing the delete access of assign object and then
    add this permission set to Hierarchy Manager User.
    There is new feature called Restriction rule (https://developer.salesforce.com/docs/atlas.en-us.restriction_rules.meta/restriction_rules/restriction_rules_about.htm#:~:text=Restriction%20rules%20let%20you%20enhance,t%20essential%20to%20their%20work)
    in current release, you can look into that.
    For Field Level Security
    Setup--> Role Hierarchy --> Making 3 roles (Given below at top) and assign it to respective user with same profile Manager (But Add permission set to Hierarchy Manager for delete access)
    Setup--> Sharing Setting--> Edit --> Assign --> Internal User --> Private --> in right side check the grant using role hierarchy
    Setup --> Assign Object --> Make picklist--> Priority Type--> Add (High Priority, Low Priority by default= High Priority)
    Setup--> Sharing Setting--> Scroll below to Assign Object Sharing Setting Permission --> New -->
    (1st) Add Label & API Name -->
    (2nd) Based on record Field If Priority_Type__c = High Priority
    (3rd) Share it to Roles = Team Lead & Executive Team Lead (Or you can make a public in which this role will added)
    Now click on save & you're done

  • Prafull

    Member
    August 7, 2021 at 11:38 am in reply to: Questions on Aura, Salesforce configurations

    2>A profile has contact delete permission.This profile is assigned to 2 users but one user should be able to delete contact other should not .How do you achieve this
    For the same scenario above let's say I have a lightning button to delete contact and I have made the class as with sharing. In this scenario what happens when I delete the contact as the two users?
    As per my uderstanding with sharing can only add restriction based on OWD and sharing rule. not profile. if user has delete access on profile then he will be able to delete.
    We can do this using 2 methods either through UI/Apex
    Using UI -->
    Making a Hierarchy custom setting(Most Restrictive Access Priority User>Profile>Organization) and then select the User for 2nd user that you want to restrict the delete permission
    Using Apex -->
    You're right about the With Sharing (Like OWD/Sharing Rule only for records not for Field & Object Level)
    For Object & Field Level Security below are the options
    You can either use
    1. Schema class method isAccessible,isUpdatable (Old Technique) https://www.apexhours.com/security-in-salesforce/
    2. new Techniques (Using StripInaccessible https://medium.com/salesforce-zolo/stripinaccessible-the-great-new-way-to-enforce-security-in-apex-e2cf79cb9500
    By adding with Security_Enforced keyword at the end of SOQL Query https://amitsalesforce.blogspot.com/2019/07/field-level-security-in-soql-with-SECURITY-ENFORCED.html)
    3>What do you do when you have a req to display list of contacts on the UI but the columns and order of columns varies from client to client?
    You can make use of API variable for LWC that will needed to add in .meta-xml file with same name of variable as in .JS file
    or in Aura Component --> Make an Aura attribute that have same name as described in .design file. After that when user need to make more columns then user can edit the page (Detail page) and in right side there is column on which they can enter number of column values
    You can either set default value in design file.
    4>How do you display 50k records on UI using Aura---- data table lazy loading??
    You can make use of LIMIT & OFFSET Keyword when retrieving the records.
    6>Suppose we a zip code field in account detail page. in that detail page we want to display another component that would show top restaurants in that zipcode. How can we achieve this?
    In this case you can make use of LDS to get record field value. Based on value you can show top restaurants (Like you can invoke rest api zomato to show top restaurants based on zip code).

    For 1st we need to use triggers as i understand the condition.

  • Prafull

    Member
    July 31, 2021 at 12:28 pm in reply to: Show space seprated number in Lightning datatable salesforce

    Hi Balram,

    You can take reference from below code.

    @track data;
    @track columns = columns;
    @api recordId;
    error;
    const columns = [
    {
    label: 'Number',
    fieldName: 'number',
    type: 'text',
    cellAttributes: { alignment: 'left' }
    }
    ];
    @wire(getData, {recordId:'$recordId' })
    wiredResult(result) {
    if (result.data) {
    var rows=result.data;
    for (var i = 0; i < rows.length; i++) {
    var row = rows[i];
    if (row.NumberValue.length>2) row.number= row.NumberValue.substring(0,2) +' '+row.NumberValue.substring(2,row.NumberValue.length);
    }
    this.data = rows;
    this.error = undefined;
    } else if (result.error) {
    this.error = result.error;
    this.data = undefined;
    }
    }

    • This reply was modified 3 years, 4 months ago by  Prafull.
  • Prafull

    Member
    July 31, 2021 at 12:18 pm in reply to: Docusign Integration - Picklist Merge Fields Showing No Options

    Hi Sam Lee,
    As error (I have no options for the signer to choose from in this field) is clearly indicating that there is not any signing element in document that you want to send to multiple user. There is signing element in left side block inside Docusgin E-Signature for Salesforce.

  • Html
    Css
    Js

  • Prafull

    Member
    May 31, 2021 at 3:36 am in reply to: How to add drop down filters in LWC in Salesforce ?

    You can either use select tag of html and get the value through template.queryselector or lightning combobox component

    Please refer below link
    https://www.google.com/amp/s/eshopsync.com/dropdown-in-lightning-web-component-lwc/amp/

  • Prafull

    Member
    May 30, 2021 at 12:04 pm in reply to: How to create a list view in Salesforce ?

    You can create it on any object/tab.

    Go to your App --> tab--> on list of records you've see that below your tab name there is recently viewes record option just change it my --> now in right side on same row you're see that settimg icon click on that --> there os option for new liat view.

    You can use list view to show only filtered records. Inline editing and saving feature.

  • Future method was comes in asynchronous process i.e annotated as @future.
    It is basically used for http callout using callout=true inthrough trigger.
    Like @future(callout=true)

    Future method wait until the resources isn't available. We can also use it to avoid mix dml operation errors.

    There are limitations on future method
    1. We can't able to pass collection data type ( list, set, map) as parameters only primitive data type allowed.
    2. It is hard to monitor.
    3. We can't able to return anything so return type is always void.

  • Prafull

    Member
    May 30, 2021 at 6:00 am in reply to: Chained queuable jobs invoked through trigger.

    As Salesforce document You can’t chain queueable jobs in an Apex test. Doing so results in an error. To avoid getting an error, you can check if Apex is running in test context by calling Test.isRunningTest() before chaining jobs.
    You can refer below link
    https://salesforce.stackexchange.com/questions/181233/system-asyncexception-maximum-stack-depth-has-been-reached
    Now in your code change List l/List LA to List<Account> l, List<Account> LA. There are 2 cases in which you will get error.
    1. Recursive trigger error i.e Too many queueable jobs added to the queue: 2
    2. For chaining the Queueable Job in Test class: System.AsyncException: Maximum stack depth has been reached.
    Please Use below code to resolve your issue
    Parent Queueable
    public with sharing class Qapex implements Queueable{
    private list<Account> L;
    public Qapex(List<Account> a) {
    this.L= a;
    }
    public void execute(QueueableContext q){
    list<Account> LA= new list<Account>();
    for(account f: this.L){
    account acc= new account();
    acc.Name= 'queable name' + f.Name;
    LA.add(acc);
    }
    INSERT LA;
    if(!Test.isRunningTest()){
    system.enqueueJob(new Qapex1());
    }
    }
    }
    Child Queueable
    public with sharing class Qapex1 implements Queueable{
    public void execute(QueueableContext QC){
    account ac = new account(name= 'new name');
    insert ac;
    }
    }
    Trigger
    if(Trigger.isBefore)
    {
    if(Trigger.isInsert || Trigger.isUpdate)
    {
    if(RecursiveTriggerHandler.isFirstTimeBeforeIns){
    system.enqueueJob(new Qapex(trigger.new));
    RecursiveTriggerHandler.isFirstTimeBeforeIns=false;
    }
    }
    }
    Test Classe for Qapex
    @istest
    public class QapexTCls {
    @istest
    public static void Qapex1TClsM() {
    account a= new account(name= 'qapextestname');
    test.startTest();
    insert a; //this will call trigger that is used to invoke queueable class
    test.stopTest();
    account ac= [select id, name from account where id= : a.id];
    system.assertEquals('qapextestname', a.name);
    }
    }
    Test Class for Qapex1
    @istest
    public class Qapex1TCls {
    @istest
    public static void Qapex1TClsM() {
    test.startTest();
    system.enqueueJob(new Qapex1());
    test.stopTest();
    }
    }

  • Prafull

    Member
    May 30, 2021 at 3:44 am in reply to: Apex Batch Class

    You can use database.stateful interface to know the state of each record using Database.SaveResult class as well as store the record information in any non static variable that we will be used in finish of our batch class. You can refer below links.

    https://www.forcetalks.com/blog/how-to-use-database-stateful-interface-in-batch-apex-in-salesforce/
    https://www.emizentech.com/blog/database-stateful-in-batch-apex.html

    • This reply was modified 3 years, 6 months ago by  Prafull.
  • Prafull

    Member
    May 30, 2021 at 3:38 am in reply to: What exactly does Salesforce do?

    Salesforce is CRM software that provides a way to improve business growth using different products of salesforce Ecosystem (Sales/Service/Marketing/Commerce/Health Cloud any many more). You can do customization in salesforce, to do this Salesforce provides both SaaS, PaaS type applications. You can learn all things to know more about salesforce from
    1. https://trailhead.salesforce.com/trails
    2. https://amitsalesforce.blogspot.com/
    3.

  • Prafull

    Member
    April 13, 2021 at 12:08 pm in reply to: How to manage Picklist Values in Salesforce ?

    There are two ways to manage picklist values in salesforce, which are given below.

    1. Picklist Value Set (Inside Setup) -> It is used as global picklist values that can be reused in one or more object as well as picklist field. You can make it by going to Setup --> Picklist Value Set --> New after creation that in any object Object Manager --> Fields & Relationship --> Picklist Field (New, Already Created) --> Use global picklist value set --> Select the picklist that've created earlier.

    2. Object Specific Picklist Values -> It is defined on fields while creating a Object. Setup -->Object Manager --> Fields & Relationship --> Picklist Field (New) --> Enter values, with each value separated by a new line.

  • Workflow Rules
    Roll-Up Summary fields
    Criteria-Based Sharing Calculations