• subodh
  • NEWBIE
  • 30 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
I have had always studied that when working with related object we need to go for after trigger and if we are working with the same object then we need to go for before trigger or for performing validation checks.. please help me because today I tried one scenario and it's working for both before and after trigger. The code is below: 
trigger UpdateAccountField  on Contact  (before insert, before update) {

    Set <String> accID = New Set <String> (); 
    For (Contact con: Trigger.new) { 
        if (con.AccountId != Null ) {
       
        accID.add (con.AccountId); 
        } 
    } 
    If (accID.size ()> 0) { 
        List <Account> upAccList = new List <Account> (); 
        For (Account ac: [SELECT Id, csrs__FieldUpdate__c FROM Account WHERE id in: AccID AND csrs__FieldUpdate__c != True]) { 
            ac.csrs__FieldUpdate__c = true; 
            UpAccList.add (ac); 
        } 
        If (upAccList.size ()> 0) 
            update upAccList; 
    } 
}
  • July 20, 2019
  • Like
  • 0
Hi All,
I have three objects Agreement, Document version and Document version detail. Here list of documents are present. There is master detail relationship between document version detail and document version.
A look up relationship between document version and Agreement.

Requirement: I want latest document present in document version detail and allow it to download on Agreement.

PLEASE SUGGEST THE WAY TO IMPLIMEIM WITHOUT CODE If it is possible, and provide me end to end guide.

Thanks
Subodh
I've created my project(LWCSessions), authorised my Dev Org, created my Scatch Org and now want to build a component HelloAimitTraineesUser-added imageUser-added image. So, I created one but, it only creates .cmp  and .auradoc  folders as per the screenshot. I notices when I created the Lightning component, taht the folder mapping automatically maps to an Aura sub-folder which is, what I suspect is causing the problem. But how do a change the mapping to, for example, LWCSessions -> force-app -> main - default -> lwc?
Also, if I simply create 2 folders for .html and .js, is that sufficient?
Hi All,
I have written a trigger to create record in price book entry when record is created in product. Now, I want to update the record in proce book entry which created due to this trigger.
Can some give me idea how to do this.

Thanks in advance
I have had always studied that when working with related object we need to go for after trigger and if we are working with the same object then we need to go for before trigger or for performing validation checks.. please help me because today I tried one scenario and it's working for both before and after trigger. The code is below: 
trigger UpdateAccountField  on Contact  (before insert, before update) {

    Set <String> accID = New Set <String> (); 
    For (Contact con: Trigger.new) { 
        if (con.AccountId != Null ) {
       
        accID.add (con.AccountId); 
        } 
    } 
    If (accID.size ()> 0) { 
        List <Account> upAccList = new List <Account> (); 
        For (Account ac: [SELECT Id, csrs__FieldUpdate__c FROM Account WHERE id in: AccID AND csrs__FieldUpdate__c != True]) { 
            ac.csrs__FieldUpdate__c = true; 
            UpAccList.add (ac); 
        } 
        If (upAccList.size ()> 0) 
            update upAccList; 
    } 
}
  • July 20, 2019
  • Like
  • 0
Hello,

I am trying to push an Apex Class which auto converts a lead into a contact.  When I try to deploy this in production I get the following error.  I am not too familiar with Apex Classes and not sure how to resolve this.

Your code coverage is 38%. You need at least 75% coverage to complete this deployment.
 
Public class AutoConvertLeads
{
    @InvocableMethod
    public static void LeadAssign(List<Id> LeadIds)
    {
            Database.LeadConvert Leadconvert = new Database.LeadConvert();
            Leadconvert.setLeadId(LeadIds[0]);
            LeadStatus Leads= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            Leadconvert.setConvertedStatus(Leads.MasterLabel);
            Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to   create an opportunity from Lead Conversion 
            Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
            System.assert(Leadconverts.isSuccess());
   }
}


Any help is much appreciated.

Thanks,

Aaron
 
How can we configure record creation in Custom object by email?