• Srivat 11
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hello All,

I am trying to extend the width of a visualforce page related list in the lightning interface, but I am unable to figure out how.
The visualforce page related list looks like this in the lightnin interface-

User-added image

The related list does not extend completely in the lightning interface but it works correctly in the classic interface.

Here is my visualforce code-
<apex:page standardController="Account" extensions="AccountRelatedListController" sidebar="true" showHeader="false"   lightningstylesheets="true">    
    <apex:form >                
        <apex:pageblock id="AccountList" tabStyle="account">  
            <div style="margin-left: 30%;"><apex:commandLink value="New Account" action="{!newAccount}" target="_parent" styleClass="btn" style="text-decoration:none;padding:4px;"/></div>
            <br/>
            <apex:pageBlockTable value="{!accounts}" var="acct" columns="4"  rendered="{!NOT(ISNULL(accounts))}">                
                <apex:column HeaderValue="Action" >
                    <apex:commandLink value="Edit" style="color:#015ba7;" action="{!editAccount}" target="_parent" ><apex:param value="{!acct.id}" name="AccountId"/>
                    </apex:commandLink>
                    &nbsp;|&nbsp;
                    <apex:commandLink value="Del" onclick="return confirm('Are you sure?')" style="color:#015ba7;" action="{!deleteAccount}" target="_parent"><apex:param value="{!acct.id}" name="AccountId"/>
                    </apex:commandLink>
                </apex:column>
                <apex:column headerValue="Account Name"><apex:outputLink value="/{!acct.id}" target="_blank">{!acct.Name}</apex:outputLink> </apex:column>              
                <apex:column value="{!acct.Industry}"/>
                <apex:column value="{!acct.Phone}"/>
                <apex:outputLabel value="No records to display" rendered="{!(ISNULL(accounts))}" styleClass="noRowsHeader"></apex:outputLabel>
            </apex:pageBlockTable>            
        </apex:pageblock>
    </apex:form>  
</apex:page>


 
Hello Trailblazers,

I have the following dependent picklist fields on the Lead object-

DNS_Drop_Down__c
Unqualified_List__c

I have created similar dependent picklist fields on the Activity/Task object-

DNS_Drop_Down_update__c
Unqualified_List_update__c

The following trigger on the Task object updates the 'Lead Status' picklist of Leads whenever the corresponding Task picklist field 'Lead Status Update' is selected. 
The requirement now is to update the DNS_Dro_Down__c and the Unqualified_List__c dependent picklists on the Leads whenever the corresponding task picklist fields - DNS_Drop_Down_update__c, Unqualified_List_update__c contain a value.

Here is the **Task Trigger** code-


trigger Task on Task (after insert, after update) 
   {
    

      
      Set<Id> whoIds = new Set<Id>();
    //Set<Id> whatIds = new Set<Id>();
     
     Map<Id,String> leadIdToStatus = new Map<Id,String>();
    //Map<Id,String> oppIdToStatus = new Map<Id,String>();

    for(Task t : Trigger.New){
        whoIds.add(t.WhoID);
        //whatIds.add(t.WhatId);
        if(t.Lead_Status_Update__c != null){
            leadIdToStatus.put(t.WhoId, t.Lead_Status_Update__c);             
        }
        /*if(t.Stage__c != null){
            oppIdToStatus.put(t.WhatId, t.Stage__c);
        }*/
    }

    List<Lead> leads = [SELECT Id FROM Lead WHERE Id =:whoIds];
    //List<Opportunity> opps = [SELECT Id FROM Opportunity WHERE Id =:whatIds];

    for(Lead l : leads){
        IF(leadIdToStatus.get(l.Id) != null){
            l.Status = leadIdToStatus.get(l.Id);
        }
        
    }

    /*for(Opportunity o : opps){
        o.StageName = oppIdToStatus.get(o.Id);
    }*/

    update leads;
    //update opps;
}

Here is the **Test class** for the Task Trigger-

@isTest
private class TestTaskTrigger {
    
    @isTest static void test_method_one() {
    
        Lead l = new Lead();
        l.LastName = 'Test';
        l.Company = 'Company';
        l.Status = 'new';
        insert l;

        Account a = new Account();
        a.Name = 'Test';
        insert a;

        Opportunity o = new Opportunity();
        o.AccountId = a.Id;
        o.Name = 'Test';
        o.StageName = 'New';
        Date d = Date.Today();
        o.CloseDate = d;
        insert o;

        Opportunity o1 = new Opportunity();
        o1.AccountId = a.Id;
        o1.Name = 'Test';
        o1.StageName = 'New';
        Date d1 = Date.Today();
        o1.CloseDate = d;
        insert o1;

        Task t = new Task();
        t.Lead_Status_Update__c = 'This';
        t.WhoId = l.Id;
        insert t;

        Task t2 = new Task();
        t.WhatId = o.Id;
        //t.Status__c = 'that';
        insert t2;
    }
}
Hi,
I am trying to change the lead owner to a particular user whenever  a new Lead comes into our ORG, by checking if the picklist field named "Lead Status" has the value "New".
Can anybody please suggest how to check for this condition ?

 
Hi,
I am trying to change the lead owner to a particular user whenever  a new Lead comes into our ORG, by checking if the picklist field named "Lead Status" has the value "New".
Can anybody please suggest how to check for this condition ?