forked from Andrew2000/Custom-Lead-Convert-Page
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leadConvertCoreComponent.vfc
134 lines (108 loc) · 6.3 KB
/
leadConvertCoreComponent.vfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!-- This component allows for the core lead converting functionality -->
<apex:component controller="leadConvertCoreComponentController">
<!-- This allows for the lookup to Account but hides the text of the selected account name leaving the magnifying glass only -->
<style type="text/css">
input.hiddenInput {
width:0;
height:0;
border:0;
padding:0;
margin:0;
}
</style>
<!-- This is the attribute that holds the lead to convert -->
<apex:attribute name="LeadToConvert"
description="The lead to convert"
type="Lead"
assignTo="{!leadConvert}"
required="true"/>
<!-- This attribute is used for the leadConvertController to interact with this component's controller -->
<apex:attribute name="thepageController"
type="PageControllerBase"
assignTo="{!pageController}"
required="true"
description="The controller for the page." />
<!-- Lead Convert section -->
<apex:pageBlockSection id="pblockconvertLead" title="Convert Lead" collapsible="no" columns="1">
<!-- Leads Record Owner -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Record Owner" for="recordOwner" />
<apex:inputField value="{!contactId.ownerID}" id="recordOwner" />
</apex:pageBlockSectionItem>
<!-- Checkbox indicating whether to send an email to the owner -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Send Email to the Owner" for="sendOwnerEmail" />
<apex:inputCheckbox value="{!sendOwnerEmail}" id="sendOwnerEmail" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="convertLeadAccountBlockSectionItem" >
<!-- Account Name picklist -->
<apex:outputLabel value="Account Name" for="accountList" />
<apex:outputPanel styleClass="requiredInput" id="block">
<div class="requiredBlock"></div>
<apex:selectList value="{!selectedAccount}" size="1"
multiselect="false" id="accountList">
<apex:actionSupport event="onchange"
action="{!accountChanged}"
rerender="opportunityName, ViewLink"
/>
<apex:selectOptions value="{!accounts}"/>
</apex:selectList>
<!-- Account lookup to add existing accounts to the picklist -->
<apex:inputField styleClass="hiddenInput"
value="{!contactId.AccountId}" id="accountId" >
<!-- When an account is looked up, it is added to the select list -->
<apex:actionSupport event="onchange"
action="{!accountLookedUp}"
rerender="accountList, opportunityName, ViewLink"
/>
</apex:inputField>
<!-- This is a link which shows a view of the selected account in a new pop up window -->
<apex:commandLink id="ViewLink" value="View"
onclick="javascript:if ('{!selectedAccount}' != 'NEW' && '{!selectedAccount}' != 'NONE' ) {var newWindow = window.open('/{!selectedAccount}/p', 'accountview', 'top=40, left=40,scrollbars=yes, height=450, width=800');newwindow.focus();} else {alert('You can only view existing accounts.');}"
/>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<!-- Opportunity section -->
<apex:pageBlockSectionItem id="oppSection" >
<apex:outputPanel id="oppPanel" >
<apex:outputLabel value="Opportunity Name" for="opportunityName" />
</apex:outputPanel>
<apex:outputPanel id="opportunityPanel" layout="block">
<apex:outputPanel rendered="{!NOT(doNotCreateOppty)}" styleClass="requiredInput" id="block">
<div class="requiredBlock"></div>
<!-- Opportunity Name -->
<apex:inputField required="false"
value="{!opportunityID.Name}" id="opportunityName"/>
<apex:outputPanel id="oppPane2" >
<apex:outputLabel value="Opportunity Record Type" for="opportunityRecordType" />
</apex:outputPanel>
<apex:inputField required="false"
value="{!Opportunityid.RecordTypeId}" id="opportunityRecordType"/>
</apex:outputPanel>
<!-- This is only shown if the Do Not Create Opportunity is true -->
<apex:inputText disabled="true" rendered="{!doNotCreateOppty}" value="{!opportunityID.Name}" id="opportunityNameDisabled"/>
<apex:outputPanel layout="block" styleClass="requiredInput">
<apex:outputPanel layout="block" />
<!-- Checkbox indicating whether to create an Opportunity -->
<apex:inputCheckbox value="{!doNotCreateOppty}" id="doNotCreateOppty">
<apex:actionSupport event="onchange"
rerender="opportunityPanel"
/>
</apex:inputCheckbox>
Do not create a new opportunity upon conversion.
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<!-- Converted Status -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Converted Status" for="leadStatus" />
<apex:outputPanel styleClass="requiredInput" layout="block">
<div class="requiredBlock"></div>
<apex:selectList id="LeadStatusList" size="1"
value="{!LeadToConvert.Status}" multiselect="false" required="true">
<apex:selectOptions value="{!LeadStatusOption}"/>
</apex:selectList>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:component>