• manish kumar 39
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Application developer
  • ca

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
User want to view contacts linked to accounts whom he is a part of account team member .he also want the ablity to slect the multiple contact and sent it to mail .
Can you please help in the controller and the visual force page for the above requirement .

 
I have a senario where these 8 field needs to be display on custom vf page 
Object / API Name Field API Name Type
Opportunity Transaction Type Transaction_Type__c Picklist
Opportunity Partner Reseller__c Lookup(Account)
Opportunity Partner Opportunity Owner Reseller_Contact__c Lookup(Contact)
Opportunity Distributor Distributor_6__c Lookup(Account)
Opportunity Distributor Opportunity Owner Distributor_Contact__c Lookup(Contact)
Opportunity Partner Engagement Partner_Engagement__c Picklist
Opportunity Service Provider Platform Cloud_Platform__c Picklist
Opportunity End User End_User_Contact__c Lookup(Contact)

but few field should hide if i select some value here are the condition 
Transaction Type should default to Direct.The following logic will need to be applied to these fields as they appear on the Convert_Lead visual force page.If Transaction Type = Direct or OEM or ERWIN

Make the following fields unavailable for edit (hide if possible) and should be blank.

Partner
Partner Opportunity Owner
Distributor
Distributor Opportunity Owner
Partner Engagement
Service Provider Platform
End User 

how do i achieve this 
i already have a custom page i am working 

<apex:page standardController="Lead" extensions="DE_ConverLead_cls" id="customconvertleadpageid" action="{!CheckIsConverted}">
    <script>
        var newWin;
        window.onload=function()
        {
            //alert("{!leadrec.Commercial_Account__r.Name}");
            var accountName = "{!leadrec.Commercial_Account__r.Name}";
            //alert(accountName);
            //var accountId = "{!leadrec.Commercial_Account__c}";
            
            //Fill in Account Name
            if(document.getElementById("{!$Component.customconvertleadpageid:theForm:hdnAccountName}").value != null)
                document.getElementById('targetName').innerHTML = document.getElementById("{!$Component.customconvertleadpageid:theForm:hdnAccountName}").value;
            else if(accountName != '')
                document.getElementById('targetName').innerHTML = accountName;
            else
                document.getElementById('targetName').innerHTML = '';
                //alert(document.getElementById('targetName').innerHTML);
        }
        
        function showhidecomponents()
        {
            document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:opprnametextid}").disabled = document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:chkoptyid}").checked;
            if(document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:chkoptyid}").checked)
                document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:opprnametextid}").value = '';
            else 
                document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:opprnametextid}").value = "{!opprName}";    
        }
        function openLookupPopup(searchPage,name, id,lid)  {
            var url="/apex/" + searchPage + "?namefield=" + name + "&idfield=" + id + "&lid=" + lid;// + "&frompage=fromlead";   
            newWin=window.open(url, 'Popup','height=500,width=1000,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');   
            if (window.focus)    {
                newWin.focus();   
            }
            return false;    
        }
        function closeLookupPopup()  
        {     
            //Added today
            if (null!=newWin)     
            {        
                newWin.close();     
            }    
        }    
        function validateFields()    {
            var isOpptycreate = document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:chkoptyid}").checked;
            //alert(document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:opprnametextid}").value);
            if(document.getElementById("{!$Component.theForm.hdnAccountID}").value == '') {
                alert('Please Select an Account'); 
                return false; 
            }    
            else if(document.getElementById("{!$Component.customconvertleadpageid:theForm:theBlock:pgblkConvertLeadid:pgblkConvertLeadid_4:opprnametextid}").value == '' && !isOpptycreate) {
                alert('Please Enter Opportunity Name');
                return flase;
            }    
            else {
                //doConvert();
                doCheckContacts();
            }    
        }
        function backfunc() {
            switchblocks();
        }    

    </script>
<apex:pageMessages ></apex:pageMessages>
    <apex:form id="theForm">
        <!--<apex:actionFunction name="doConvert" action="{!ConvertLeadRecord_1}" />-->
        <apex:actionFunction name="doCheckContacts" action="{!checkContacts}" />
        <apex:pageBlock id="theBlock" mode="edit" rendered="{!isConvertLeadBlock}">
            <apex:pageblockButtons >
                <apex:commandButton value="Convert" onclick="validateFields(); return false;"/>
                <apex:commandButton value="Cancel" action="{!cancelMeth}"/>    
            </apex:pageblockButtons>
            <apex:pageBlockSection columns="1" title="Convert Lead" id="pgblkConvertLeadid">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Record Owner"/>
                    <apex:inputField value="{!leadrec.ownerid}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Send Email to the Owner" />
                    <apex:inputcheckbox value="{!IsSendEmailChecked}"/>
                </apex:pageBlockSectionItem>
                <apex:pageblockSectionItem >
                <apex:outputLabel value="Account Name" />
                <apex:outputPanel styleClass="requiredInput" layout="block" >
                    <apex:outputPanel styleClass="requiredBlock" layout="block"/>
                    <div id="targetName" style="float:left;font-size:12px"></div>  &nbsp; 
                        <a href="#" onclick="openLookupPopup('DE_AccSearch_VFP','{!$component.theForm.hdnAccountName}', '{!$component.theForm.hdnAccountID}', '{!leadrec.id}'); return false">
                        <!--<a href="#" onclick="openLookupPopup('CAEndUserAccountSearch','{!$Component.hdnAccountName}', '{!$Component.hdnAccountID}'); return false">-->                   
                            <img title="Account Name Lookup (New Window)" class="lookupIcon" alt="Account Name Lookup (New Window)" src="/s.gif"/>                 
                        </a>                         
                </apex:outputPanel>
            </apex:pageblockSectionItem>    
  
            <apex:pageblockSectionItem id="pgblkConvertLeadid_4">
                <apex:outputLabel value="Opportunity Name" id="Opptylabelid"/>
                <apex:outputPanel >
                     <apex:outputPanel styleClass="requiredInput" layout="block" id="optyoutputpanelid">
                        <apex:outputPanel styleClass="requiredBlock" layout="block" />
                        <apex:outputpanel >
                            <apex:inputtext value="{!opprName}" id="opprnametextid"/><br/>
                        </apex:outputpanel>                      
                     </apex:outputPanel>
                     <apex:outputPanel >
                             <apex:inputcheckbox value="{!isOpportunityCreate}" id="chkoptyid" onclick="showhidecomponents();"/>
                            <apex:outputlabel value="Do not create a new opprtunity upon conversion" />                                  
                    </apex:outputPanel> 
                 </apex:outputPanel>    
            </apex:pageblockSectionItem>
            <apex:pageblockSectionItem >
                <apex:outputLabel value="Converted Status"/>
                <apex:selectList value="{!selctedConvertedStatus}" size="1" onchange="RTMTypeValues()">
                        <apex:selectOptions value="{!ConvertedStatusList}"></apex:selectOptions>
                </apex:selectList>
            </apex:pageblockSectionItem>
            </apex:pageBlockSection>    
            <apex:pageBlockSection columns="2" title="Task Information">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Subject"/>
                    <apex:inputField value="{!taskrec.Subject}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Due Date"/>
                    <apex:inputField value="{!taskrec.ActivityDate}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Type"/>
                    <apex:inputField value="{!taskrec.Type}"/>        
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Status"/>
                    <apex:inputField value="{!taskrec.Status}"/>        
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Priority"/>
                    <apex:inputField value="{!taskrec.Priority}"/>        
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="1" title="Task Information">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Comments"/>
                    <apex:inputField value="{!taskrec.Description}" style="width:420px;height:80px"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputpanel id="commnentsid">
                        <apex:inputcheckbox value="{!setSendNotificationEmail}"/>
                        <apex:outputLabel value="Send Notification Email" />
                    </apex:outputpanel>    
                </apex:pageBlockSectionItem>    
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="2" title="Reminder">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Reminder"/>
                    <apex:outputPanel id="reminderpanelid">
                        <apex:outputLabel value=""></apex:outputLabel>
                        <apex:inputcheckbox value="{!taskrec.IsReminderSet}"/>
                        <apex:inputField value="{!taskrec.ReminderDateTime}"/>
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>        
        
        <apex:inputHidden id="hdnAccountName" value="{!endUserAccountName}"/>
        <apex:inputHidden id="hdnAccountID" value="{!hdnAccountId}"/>

        <!--Contact Block-->
        <apex:pageBlock title="Convert Lead" rendered="{!isContactBlock}" mode="edit">
            <apex:pageBlockSection columns="1" title="Contacts">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Account Name" />
                    <apex:outputText value="{!endUserAccountName}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact Name" />
                    <apex:outputPanel styleClass="requiredInput" layout="block" >
                        <apex:outputPanel styleClass="requiredBlock" layout="block" />
                        <apex:selectList value="{!selectedContact}" size="1">
                            <apex:selectOptions value="{!contactPickList}"></apex:selectOptions>
                        </apex:selectList>
                    </apex:outputPanel>
                </apex:pageBlockSectionItem> 
        </apex:pageBlockSection>    
                
        <apex:pageBlockButtons >
        <apex:commandButton value="Convert" action="{!ConvertLeadRecord_1}" />
        <apex:commandButton value="Back" onclick="backfunc"/>
        <apex:actionfunction name="switchblocks" action="{!switchBlock}"/>
        </apex:pageBlockButtons> 
        </apex:pageBlock>
        
    </apex:form>

</apex:page>

 
How do i check if roolup summary field and formula field value get change ?
My requirement is to change the formula field value if any of the 10 rollup summary value get change ?
 

I have one formula field called Status_Formula whose value needs to be change depending on the condition
Condition 1:
IF the contract source is TOPS OR SAP,
                The valuation status field should change from Validated to Assigned as below…
                condition 2: ONLY IF one of the Contract Values below changes.
Adjusted_TRR_LC__c,
Adjusted_TRR_USD__c,

Raw_Maint_Calc_LC__c,
Raw_Maint_USD__c,
ATTRF_CRV__c,
ATTRF_USD__c,
(most of these fields are rollup summary or number field )
I have check the first condition
IF(OR(SAP_TOPS__c='T',SAP_TOPS__c='S'),'Assigned',

How do i check the second condition ?  

 
i have implement pagination to display and select contacts for one output field and which is working fine but when i try to click on the save button and validation error occurs on page the selected contacts get lost can someone please provide me the fix ?

I have one formula field called Status_Formula whose value needs to be change depending on the condition
Condition 1:
IF the contract source is TOPS OR SAP,
                The valuation status field should change from Validated to Assigned as below…
                condition 2: ONLY IF one of the Contract Values below changes.
Adjusted_TRR_LC__c,
Adjusted_TRR_USD__c,

Raw_Maint_Calc_LC__c,
Raw_Maint_USD__c,
ATTRF_CRV__c,
ATTRF_USD__c,
(most of these fields are rollup summary or number field )
I have check the first condition
IF(OR(SAP_TOPS__c='T',SAP_TOPS__c='S'),'Assigned',

How do i check the second condition ?  

 
i have implement pagination to display and select contacts for one output field and which is working fine but when i try to click on the save button and validation error occurs on page the selected contacts get lost can someone please provide me the fix ?