-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
16Questions
-
20Replies
Replicate Case Comments on Opportunity
I'm trying to replicate the Case comments format on an opportunity. I created a custom object Opportunity_Comments__c. I did some testing and the comment will only show the first 255 characters in the related list. How can I build a visualforce page to show the opportunity comments on that particular opportunity without the 255 limit. The only fields I need showing are "Name" and "Comment__c".
- Zach Ackerman
- April 25, 2017
- Like
- 0
Pagination Class for Tasks
I have the following pagination code/vf page. I am getting an error that says 'List controllers are not supported for Task '. How can I update the code to make the visualforce page work?
Apex:
VisualForce:
Apex:
public class PaginationTaskHomePage1{ public String soql {get;set;} public List <Task> TaskList1 = New List <Task>(); public String soqlsort {get;set;} public List <Task> TaskList2= New List <Task>(); Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public List <Task> getTaskList() { return con.getRecords(); } public Apexpages.StandardSetController con{ get{ if(con==null){ size=500; string OwnersId = userinfo.getUserId() ; string type1 = 'Lost NB Round 1'; string type2 = 'Lost Renewals'; soqlsort='Select Subject,WhoID,WhatId,OwnerId,Opportunity_Effective_Date__c,Primary_Medical_Effective_Date__c,Type,CreatedDate From Task Where OwnerId = :OwnersId AND (Type = :type1 OR Type= :type2)'; TaskList1 = Database.query(soqlsort + ' Order by ' + sortField +' ' + sortDir); con= new ApexPages.StandardSetController(TaskList1); con.setPageSize(size); noOfRecords=Con.getResultSize(); } return con; } set; } public Boolean hasNext { get { return con.getHasNext(); } set; } //indicates whether therre are more records before the current page set. public Boolean hasPrevious{ get{ return con.getHasPrevious(); } set; } public Integer pageNumber { get{ return con.getPageNumber(); } set; } public void next(){ con.next(); } //returns the PageRerfernce of the original page, if known, or home page. public void cancel() { con.cancel(); } // Method for Constructor is used for Test Class public PaginationTaskHomePage1() { } //Toggles the sorting of query from asc to desc public void toggleSort() { //simply toggle the direction sortDir= sortDir.equals('asc') ? 'desc' : 'asc'; //run the query again for sorting other columns string OwnersId = userinfo.getUserId() ; string type1 = 'Lost NB Round 1'; string type2 = 'Lost Renewals'; soqlsort = 'Select Subject,WhoID,WhatId,OwnerId,Opportunity_Effective_Date__c,Primary_Medical_Effective_Date__c,Type,CreatedDate From Task Where OwnerId = :OwnersId AND (Type = :type1 OR Type= :type2)'; //adding string array to a List array TaskList2 = Database.query(soqlsort + ' Order by ' + sortField + ' ' + sortDir); // Adding Caselist to standard Pagination controller variable con= new ApexPages.StandardSetController(TaskList2); //Set Page Size to 500 con.setPageSize(500); } //the current sort direction defaults to asc public String sortDir{ //To set a direction either in ascending order or descending order. get{if(sortDir==null){sortDir = 'asc';} return sortDir;} set; } //the current field to sort by. defaults to probability public String sortField{ //to set a field sorting. get{if (sortField==null){sortField='Opportunity_Effective_Date__c';} return sortField;} set; } public pageReference refresh() { Con = null; getTaskList(); Con.setPageNumber(1); return null; } }
VisualForce:
<apex:page controller="PaginationTaskHomePage1" tabstyle="Task"> <apex:form > <apex:pageBlock id="pb"> <apex:sectionHeader title="{!$User.FirstName}'s Lost Renewal & New Business List"/> <apex:commandButton value="New Opportunity" onClick="window.open('https://cs15.salesforce.com/006/e?retURL=%2F006%2Fo&RecordType=01240000000Uexl&ent=Opportunity');"/> <apex:commandButton value="Detailed Report" onClick="window.open('https://cs15.salesforce.com/00Oe0000000fRSG');"/> <apex:pageBlockTable value="{!TaskList}" var="o" id="myTable"> <apex:column > <apex:facet name="header"> <apex:commandLink value="Subject" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Subject" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputlink value="/{!o.subject}" target="__blank">{!o.subject}</apex:outputlink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="WhoID" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="WhoId" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.WhoId}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="WhatId" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="WhatId" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.WhatId}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="OwnerId" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="OwnerId" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputlink value="/{!o.OwnerId}" target="__blank">{!o.OwnerId}</apex:outputlink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Opportunity_Effective_Date__c" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Opportunity_Effective_Date__c" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Opportunity_Effective_Date__c}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Primary_Medical_Effective_Date__c" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Primary_Medical_Effective_Date__c" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Primary_Medical_Effective_Date__c}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Type" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Type" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Type}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Create Date" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="CreatedDate" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.CreatedDate}" /> </apex:column> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!Con.first}" disabled="{!!Con.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!Con.previous}" disabled="{!!Con.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!Con.next}" disabled="{!!Con.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!Con.last}" disabled="{!!Con.hasNext}" title="Last Page"/> <apex:outputText >{!(Con.pageNumber * size)+1-size}-{!IF((Con.pageNumber * size)>noOfRecords, noOfRecords,(Con.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>
- Zach Ackerman
- February 27, 2017
- Like
- 0
VF Sorting
I have the following code and visualforce. I wanted to give users the ability to click on the column headers to allow them to sort the table. Is this possible? I've seen a few things online, but was unable to get it to work with pagination.
Apex:
Visual Force
Apex:
public with sharing class Pagination_min { Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public ApexPages.StandardSetController setCon { get{ if(setCon == null){ size = 500; string OwnersId = userinfo.getUserId() ; string Rectypeid = '01240000000Uexl'; string Rectypeid2 = '01240000000cnJS'; string queryString = 'Select Name, StageName,FED__c,Broker__c,Broker_Name__c,Core_Product__c,LeadSource,Number_Quoted__c,CreatedDate FROM Opportunity Where OwnerId = :OwnersId AND IsClosed = False AND (RecordTypeId = :Rectypeid OR RecordTypeId= :RecTypeId2) order by Probability,FED__c asc'; setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString)); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; }set; } Public List<Opportunity> getOpps(){ List<Opportunity> oppList = new List<Opportunity>(); for(Opportunity o : (List<Opportunity>)setCon.getRecords()) oppList.add(o); return oppList; } public pageReference refresh() { setCon = null; getOpps(); setCon.setPageNumber(1); return null; } }
Visual Force
<apex:page controller="Pagination_min"> <apex:sectionHeader title="My Opportunity List"/> <apex:form > <apex:commandButton value="New Opportunity" onClick="window.open('https://cs15.salesforce.com/006/e?retURL=%2F006%2Fo&RecordType=01240000000Uexl&ent=Opportunity');"/> <apex:commandButton value="Detailed Report" onClick="window.open('https://cs15.salesforce.com/00Oe0000000fRSG');"/> <apex:pageBlock id="pb"> <apex:pageBlockTable value="{!opps}" var="o"> <apex:column headerValue="Opportunity Name"> <apex:outputlink value="/{!o.id}" target="__blank">{!o.Name}</apex:outputlink> </apex:column> <apex:column value="{!o.StageName}"/> <apex:column headerValue="Effective Date" value="{!o.FED__c}"/> <apex:column headerValue="Broker Name"> <apex:outputlink value="/{!o.Broker__c}" target="__blank">{!o.Broker_Name__c}</apex:outputlink> </apex:column> <apex:column value="{!o.Core_Product__c}"/> <apex:column value="{!o.LeadSource}"/> <apex:column value="{!o.Number_Quoted__c}"/> <apex:column value="{!o.CreatedDate}"/> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>
- Zach Ackerman
- February 14, 2017
- Like
- 0
test class for apex code with visual force.
I have a piece of code that is then used with VF. I am attempting to create a test class. I'm struggling to build the test class.
Apex
Visual Force
Test Class
Apex
public with sharing class Pagination_min { Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public ApexPages.StandardSetController setCon { get{ if(setCon == null){ size = 500; string OwnersId = userinfo.getUserId() ; string Rectypeid = '01240000000Uexl'; string Rectypeid2 = '01240000000cnJS'; string queryString = 'Select Name, StageName,FED__c,Broker__c,Broker_Name__c,Core_Product__c,LeadSource,Number_Quoted__c,CreatedDate FROM Opportunity Where OwnerId = :OwnersId AND IsClosed = False AND (RecordTypeId = :Rectypeid OR RecordTypeId= :RecTypeId2) order by FED__c'; setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString)); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; }set; } Public List<Opportunity> getOpps(){ List<Opportunity> oppList = new List<Opportunity>(); for(Opportunity o : (List<Opportunity>)setCon.getRecords()) oppList.add(o); return oppList; } public pageReference refresh() { setCon = null; getOpps(); setCon.setPageNumber(1); return null; } }
Visual Force
<apex:page controller="Pagination_min"> <apex:form > <apex:commandButton value="New Opportunity" onClick="window.open('https://cs15.salesforce.com/006/e?retURL=%2F006%2Fo&RecordType=01240000000Uexl&ent=Opportunity');"/> <apex:pageBlock id="pb"> <apex:pageBlockTable value="{!opps}" var="o"> <apex:column headerValue="Opportunity Name"> <apex:outputlink value="/{!o.id}" target="__blank">{!o.Name}</apex:outputlink> </apex:column> <apex:column value="{!o.StageName}"/> <apex:column value="{!o.FED__c}"/> <apex:column headerValue="Broker"> <apex:outputlink value="/{!o.Broker__c}" target="__blank">{!o.Broker_Name__c}</apex:outputlink> </apex:column> <apex:column value="{!o.Core_Product__c}"/> <apex:column value="{!o.LeadSource}"/> <apex:column value="{!o.Number_Quoted__c}"/> <apex:column value="{!o.CreatedDate}"/> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>
Test Class
@isTest private class TESTPagination_min{ static testMethod void methodA() { Account acc = new Account(); acc.Name = 'test'; acc.Armada_Division__c = 'Test'; insert acc; Opportunity opp = new Opportunity(); opp.Name='Test'; opp.CloseDate=system.today(); opp.StageName='Prospecting'; opp.FED__c=system.today(); insert opp; PageReference myVfPage = Page.MyOpportunities2; Test.setCurrentPageReference(myVfPage); // use setCurrentPageReference, ApexPages.currentPage().getParameters().put('id',Opp.Id); String id = ApexPages.currentPage().getParameters().get('id'); system.assertEquals(true,id!=null); ApexPages.StandardController sc = new ApexPages.StandardController(opp); Pagination_min ac = new Pagination_min(); } }
- Zach Ackerman
- February 12, 2017
- Like
- 0
Visualforce new window and column sorting
I have the following apex and visualforce.
I have added a commandbutton at the top of the visualforce page, but i want the click to open in a new window. Right now it is opening in the VF window.
I also want to have the ability to let the user sort the columns by clicking on the column header.
VisualForce
I have added a commandbutton at the top of the visualforce page, but i want the click to open in a new window. Right now it is opening in the VF window.
I also want to have the ability to let the user sort the columns by clicking on the column header.
VisualForce
<apex:page controller="Pagination_min"> <apex:form > <apex:commandButton value="New Opportunity" action="https://cs15.salesforce.com/006/e?retURL=%2F006%2Fo&RecordType=01240000000Uexl&ent=Opportunity"/> <apex:pageBlock id="pb"> <apex:pageBlockTable value="{!opps}" var="o"> <apex:column headerValue="Opportunity Name"> <apex:outputlink value="/{!o.id}" target="__blank">{!o.Name}</apex:outputlink> </apex:column> <apex:column value="{!o.StageName}"/> <apex:column value="{!o.FED__c}"/> <apex:column headerValue="Broker"> <apex:outputlink value="/{!o.Broker__c}" target="__blank">{!o.Broker_Name__c}</apex:outputlink> </apex:column> <apex:column value="{!o.Core_Product__c}"/> <apex:column value="{!o.LeadSource}"/> <apex:column value="{!o.Number_Quoted__c}"/> <apex:column value="{!o.CreatedDate}"/> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>Apex
public with sharing class Pagination_min { Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public ApexPages.StandardSetController setCon { get{ if(setCon == null){ size = 500; string OwnersId = userinfo.getUserId() ; string Rectypeid = '01240000000Uexl'; string Rectypeid2 = '01240000000cnJS'; string queryString = 'Select Name, StageName,FED__c,Broker__c,Broker_Name__c,Core_Product__c,LeadSource,Number_Quoted__c,CreatedDate FROM Opportunity Where OwnerId = :OwnersId AND IsClosed = False AND (RecordTypeId = :Rectypeid OR RecordTypeId= :RecTypeId2) order by FED__c'; setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString)); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; }set; } Public List<Opportunity> getOpps(){ List<Opportunity> oppList = new List<Opportunity>(); for(Opportunity o : (List<Opportunity>)setCon.getRecords()) oppList.add(o); return oppList; } public pageReference refresh() { setCon = null; getOpps(); setCon.setPageNumber(1); return null; } }
- Zach Ackerman
- February 12, 2017
- Like
- 0
New Opportunity on Home Page Visual Force
I have a piece of code that shows the user all of the opportunities assigned to them. See the apex and visualforce below. The two things I can't figure out is how to give the user the ability to filter all of the columns. Additionally i'm curious if i could have a button "New Opportunity" that would launch them to the new opportunity screen.
Apex:
Visual Force
Apex:
public with sharing class Pagination_min { Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public ApexPages.StandardSetController setCon { get{ if(setCon == null){ size = 500; string OwnersId = userinfo.getUserId() ; string Rectypeid = '01240000000Uexl'; string Rectypeid2 = '01240000000cnJS'; string queryString = 'Select Name, StageName,FED__c,Broker__c,Broker_Name__c,Core_Product__c,LeadSource,Number_Quoted__c,CreatedDate FROM Opportunity Where OwnerId = :OwnersId AND IsClosed = False AND (RecordTypeId = :Rectypeid OR RecordTypeId= :RecTypeId2) order by FED__c'; setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString)); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; }set; } Public List<Opportunity> getOpps(){ List<Opportunity> oppList = new List<Opportunity>(); for(Opportunity o : (List<Opportunity>)setCon.getRecords()) oppList.add(o); return oppList; } public pageReference refresh() { setCon = null; getOpps(); setCon.setPageNumber(1); return null; } }
Visual Force
<apex:page controller="Pagination_min"> <apex:form > <apex:pageBlock id="pb"> <apex:pageBlockTable value="{!opps}" var="o"> <apex:column headerValue="Opportunity Name"> <apex:outputlink value="/{!o.id}" target="__blank">{!o.Name}</apex:outputlink> </apex:column> <apex:column value="{!o.StageName}"/> <apex:column value="{!o.FED__c}"/> <apex:column headerValue="Broker"> <apex:outputlink value="/{!o.Broker__c}" target="__blank">{!o.Broker_Name__c}</apex:outputlink> </apex:column> <apex:column value="{!o.Core_Product__c}"/> <apex:column value="{!o.LeadSource}"/> <apex:column value="{!o.Number_Quoted__c}"/> <apex:column value="{!o.CreatedDate}"/> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>
- Zach Ackerman
- February 10, 2017
- Like
- 0
List View VFPage
I have created a VF Page of an opportunity list view. One of the fields is Opportunity Name. When you click the name it opens the record in the VFPage. Can I modify the code to open a new tab when the opportunity is clicked?
<apex:page sidebar="false">
<apex:enhancedlist height="450" listid="00Be0000001eBaB" rowsperpage="100">;
</apex:enhancedlist></apex:page>
<apex:page sidebar="false">
<apex:enhancedlist height="450" listid="00Be0000001eBaB" rowsperpage="100">;
</apex:enhancedlist></apex:page>
- Zach Ackerman
- February 09, 2017
- Like
- 0
Sum multiple fields
I wanted to create a formula to sum fields. Right now this is the formula I have.
(IF(Opportunity.UH_Covered_Lives__c:SUM> 0,Opportunity.Final_Sold_Lives__c:SUM,+IF(Opportunity.UH_Covered_Lives__c:SUM<0,Opportunity.UH_Covered_Lives__c:SUM,0)))
I am attempting to SUM Final Sold Lives (FSL) in the event UH Covered Lives (UCL) is empty and then sum that number to the instances where UCL is not empty. Right now I'm only returning the total for FSL. The below example I would expect the total to be 31 not 11.
(IF(Opportunity.UH_Covered_Lives__c:SUM> 0,Opportunity.Final_Sold_Lives__c:SUM,+IF(Opportunity.UH_Covered_Lives__c:SUM<0,Opportunity.UH_Covered_Lives__c:SUM,0)))
I am attempting to SUM Final Sold Lives (FSL) in the event UH Covered Lives (UCL) is empty and then sum that number to the instances where UCL is not empty. Right now I'm only returning the total for FSL. The below example I would expect the total to be 31 not 11.
- Zach Ackerman
- December 14, 2016
- Like
- 0
Indexing
I'm need to get this piece of code indexed. I have never done indexing before would appreciate some help.
001 Trigger PlanPackageNames on Plan__c (Before Insert,Before Update){ 002 003 for (Plan__c Plan : Trigger.new){ 004 //UH Plan Names 005 IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' && 006 Plan.Sum_of_Benefits__c ==227500){ 007 Plan.Name= 'Ultimate Health'+' '+'Diamond'; 008 plan.meritain_coverage_category__c='EXC'; 009 plan.plan_code__c='EHOB'; 010 plan.plan_name__c='Diamond'; 011 } 012 IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' && 013 Plan.Sum_of_Benefits__c ==0){ 014 Plan.Name= 'Ultimate Health'+' '+'Diamond'; 015 plan.meritain_coverage_category__c='EXC'; 016 plan.plan_code__c='EHOB'; 017 plan.plan_name__c='Diamond'; 018 } 019 IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&& 020 Plan.Sum_of_Benefits__c<>0 && 021 (Plan.Annual_Family_Maximum__c<>100000|| 022 Plan.Annual_Single_Maximum__c<>100000|| 023 Plan.Vision__c<>1500|| 024 Plan.Dental__c<>5000|| 025 Plan.RX__c<>4000|| 026 Plan.Counseling__c<>3000|| 027 Plan.Wellness__c<>1500|| 028 Plan.Medical_Equipment__c<>10000|| 029 Plan.Executive_Physical__c<>2500)) 030 { 031 Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond'; 032 plan.meritain_coverage_category__c='EXC'; 033 plan.plan_code__c='EHOB'; 034 plan.plan_name__c='Diamond'; 035 } 036 IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&& 037 Plan.Sum_of_Benefits__c==0){ 038 Plan.Name= 'Ultimate Health'+' '+'Platinum'; 039 plan.meritain_coverage_category__c='EXC'; 040 plan.plan_code__c='EHEB'; 041 plan.plan_name__c='Platinum'; 042 } 043 IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&& 044 Plan.Sum_of_Benefits__c==115000){ 045 Plan.Name= 'Ultimate Health'+' '+'Platinum'; 046 plan.meritain_coverage_category__c='EXC'; 047 plan.plan_code__c='EHEB'; 048 plan.plan_name__c='Platinum'; 049 } 050 IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&& 051 Plan.Sum_of_Benefits__c<>0 && 052 (Plan.Annual_Family_Maximum__c<>50000|| 053 Plan.Annual_Single_Maximum__c<>50000|| 054 Plan.Vision__c<>1000|| 055 Plan.Dental__c<>4000|| 056 Plan.RX__c<>2500|| 057 Plan.Counseling__c<>2000|| 058 Plan.Wellness__c<>1000|| 059 Plan.Medical_Equipment__c<>2500|| 060 Plan.Executive_Physical__c<>2000)){ 061 Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Platinum'; 062 plan.meritain_coverage_category__c='EXC'; 063 plan.plan_code__c='EHEB'; 064 plan.plan_name__c='Platinum'; 065 } 066 IF(Plan.Armada_Plan_Package_Name__c=='Gold'&& 067 Plan.Sum_of_Benefits__c==0){ 068 Plan.Name= 'Ultimate Health'+' '+'Gold'; 069 plan.meritain_coverage_category__c='EXC'; 070 plan.plan_code__c='EHDB'; 071 plan.plan_name__c='Gold'; 072 } 073 IF(Plan.Armada_Plan_Package_Name__c=='Gold'&& 074 Plan.Sum_of_Benefits__c==57500){ 075 Plan.Name= 'Ultimate Health'+' '+'Gold'; 076 plan.meritain_coverage_category__c='EXC'; 077 plan.plan_code__c='EHDB'; 078 plan.plan_name__c='Gold'; 079 } 080 IF(Plan.Armada_Plan_Package_Name__c=='Gold'&& 081 Plan.Sum_of_Benefits__c<>0 && 082 (Plan.Annual_Family_Maximum__c<>25000|| 083 Plan.Annual_Single_Maximum__c<>25000|| 084 Plan.Vision__c<>500|| 085 Plan.Dental__c<>2000|| 086 Plan.RX__c<>1500|| 087 Plan.Counseling__c<>1000|| 088 Plan.Wellness__c<>500|| 089 Plan.Medical_Equipment__c<>1000|| 090 Plan.Executive_Physical__c<>1000)){ 091 Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Gold'; 092 plan.meritain_coverage_category__c='EXC'; 093 plan.plan_code__c='EHDB'; 094 plan.plan_name__c='Gold'; 095 } 096 IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&& 097 Plan.Sum_of_Benefits__c==0){ 098 Plan.Name= 'Ultimate Health'+' '+'Diamond Plus'; 099 plan.meritain_coverage_category__c='EXC'; 100 plan.plan_code__c='EHMB'; 101 plan.plan_name__c='Diamond Plus'; 102 } 103 IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&& 104 Plan.Sum_of_Benefits__c==270000){ 105 Plan.Name= 'Ultimate Health'+' '+'Diamond Plus'; 106 plan.meritain_coverage_category__c='EXC'; 107 plan.plan_code__c='EHMB'; 108 plan.plan_name__c='Diamond Plus'; 109 } 110 IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&& 111 Plan.Sum_of_Benefits__c<>0&& 112 (Plan.Annual_Family_Maximum__c<>100000|| 113 Plan.Annual_Single_Maximum__c<>100000|| 114 Plan.Vision__c<>10000|| 115 Plan.Dental__c<>10000|| 116 Plan.RX__c<>10000|| 117 Plan.Counseling__c<>10000|| 118 Plan.Wellness__c<>10000|| 119 Plan.Medical_Equipment__c<>10000|| 120 Plan.Executive_Physical__c<>10000)){ 121 Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond Plus'; 122 plan.meritain_coverage_category__c='EXC'; 123 plan.plan_name__c='Diamond Plus'; 124 } 125 IF(Plan.Armada_Plan_Package_Name__c=='2000'){ 126 Plan.Name='Ultimate Health'+' '+2000; 127 Plan.Meritain_Coverage_category__c='EXC'; 128 plan.plan_code__c='EH1A'; 129 plan.plan_name__c='2000'; 130 } 131 IF(Plan.Armada_Plan_Package_Name__c=='4000'){ 132 Plan.Name='Ultimate Health'+' '+4000; 133 Plan.Meritain_Coverage_category__c='EXC'; 134 plan.plan_code__c='EH2B'; 135 plan.plan_name__c='2000'; 136 } 137 138 //AH Plan Names. 139 140 IF(Plan.Armada_Plan_Package_Name__c=='TopDoc Connect'&& 141 Plan.TopDoc_connect__c=='Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'|| 142 Plan.TopDoc_Connect__c==' ') 143 { 144 Plan.Name=Plan.Armada_Plan_Package_Name__c; 145 plan.meritain_coverage_category__c='ARM'; 146 plan.plan_name__c='TopDoc Connect'; 147 } 148 If(Plan.Armada_Plan_Package_Name__c=='TopDoc Connect'&& 149 (Plan.Take_Me_Home__c<>NULL)) 150 { 151 Plan.Name='TopDoc Connect' +' '+'Modified'+' '+Plan.Armada_Plan_Package_Name__c; 152 plan.meritain_coverage_category__c='ARM'; 153 plan.plan_name__c='TopDoc Connect'; 154 } 155 IF(Plan.Armada_Plan_Package_Name__c=='Global Assistance'&& 156 Plan.Product_Name__c=='TD'&& 157 Plan.TopDoc_connect__c=='Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'&& 158 Plan.Take_Me_Home__c=='Travel Portal;Travel Assistance') 159 { 160 Plan.Name='TopDoc Connect' +' '+Plan.Armada_Plan_Package_Name__c; 161 plan.meritain_coverage_category__c='ARM'; 162 plan.plan_name__c='TopDoc Connect with Global Assistance'; 163 } 164 If(Plan.Armada_Plan_Package_Name__c=='Global Assistance'&& 165 Plan.Product_Name__c=='TD'&& 166 (Plan.TopDoc_connect__c<>'Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'|| 167 Plan.Take_Me_Home__c<>'Travel Portal;Travel Assistance')) 168 { 169 Plan.Name='TopDoc Connect' +' '+'Modified'+' '+Plan.Armada_Plan_Package_Name__c; 170 plan.meritain_coverage_category__c='ARM'; 171 plan.plan_name__c='TopDoc Connect with Global Assitance'; 172 } 173 174 IF(Plan.Armada_Plan_Package_Name__c=='Global Assistance'&& 175 Plan.Product_Name__c=='TR'&& 176 Plan.Take_Me_Home__c=='Travel Portal;Travel Assistance') 177 { 178 Plan.Name='Travel' +' '+Plan.Armada_Plan_Package_Name__c; 179 plan.meritain_coverage_category__c='ARM'; 180 plan.plan_name__c='Global Assitance'; 181 } 182 If(Plan.Armada_Plan_Package_Name__c=='Global Assistance'&& 183 Plan.Product_Name__c=='TR'&& 184 Plan.Take_Me_Home__c<>'Travel Portal;Travel Assistance') 185 { 186 Plan.Name='Travel' +' '+'Modified'+' '+Plan.Armada_Plan_Package_Name__c; 187 plan.meritain_coverage_category__c='ARM'; 188 plan.plan_name__c='Global Assitance';} 189 190 191 IF(Plan.Armada_Plan_Package_Name__c=='Take Me Home'&& 192 Plan.Product_Name__c=='TD'&& 193 Plan.TopDoc_connect__c=='Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'&& 194 Plan.Take_Me_Home__c=='Travel Portal;Travel Assistance;Paid Medical Evacuation') 195 { 196 Plan.Name='TopDoc Connect' +' '+Plan.Armada_Plan_Package_Name__c; 197 plan.meritain_coverage_category__c='ARM'; 198 plan.plan_name__c='TopDoc Connect with Take Me Home'; 199 plan.plan_code__c='EMFM'; 200 } 201 If(Plan.Armada_Plan_Package_Name__c=='Take Me Home'&& 202 Plan.Product_Name__c=='TD'&& 203 (Plan.TopDoc_connect__c<>'Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'|| 204 Plan.Take_Me_Home__c<>'Travel Portal;Travel Assistance;Paid Medical Evacuation')) 205 { 206 Plan.Name='TopDoc Connect' +' '+'Modified'+' '+Plan.Armada_Plan_Package_Name__c; 207 plan.meritain_coverage_category__c='ARM'; 208 plan.plan_name__c='TopDoc Connect with Take Me Home'; 209 plan.plan_code__c='EMFM'; 210 } 211 212 IF(Plan.Armada_Plan_Package_Name__c=='Take Me Home'&& 213 Plan.Product_Name__c=='TR'&& 214 Plan.Take_Me_Home__c=='Travel Portal;Travel Assistance;Paid Medical Evacuation') 215 { 216 Plan.Name='Travel' +' '+Plan.Armada_Plan_Package_Name__c; 217 plan.meritain_coverage_category__c='ARM'; 218 plan.plan_name__c='Take Me Home'; 219 plan.plan_code__c='EMFM'; 220 } 221 If(Plan.Armada_Plan_Package_Name__c=='Take Me Home'&& 222 Plan.Product_Name__c=='TR'&& 223 Plan.Take_Me_Home__c<>'Travel Portal;Travel Assistance;Paid Medical Evacuation') 224 { 225 Plan.Name='Travel' +' '+'Modified'+' '+Plan.Armada_Plan_Package_Name__c; 226 plan.meritain_coverage_category__c='ARM'; 227 plan.plan_name__c='Take Me Home'; 228 plan.plan_code__c='EMFM';} 229 230 231 232 233 234 //UH Summary of Benefits 235 236 IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' && 237 Plan.Sum_of_Benefits__c ==0) 238 { 239 Plan.Annual_Family_Maximum__c=100000; 240 Plan.Annual_Single_Maximum__c=100000; 241 Plan.Vision__c=1500; 242 Plan.Dental__c=5000; 243 Plan.RX__c=4000; 244 Plan.Counseling__c=3000; 245 Plan.Wellness__c=1500; 246 Plan.Medical_Equipment__c=10000; 247 Plan.Executive_Physical__c=2500; 248 Plan.Medical_Expense_Coverage__c='All 213 Eligible'; 249 Plan.Deductible__c=0; 250 Plan.Co_insurance__c=0; 251 Plan.TopDoc_Connect__c='Not Applicable'; 252 Plan.Take_Me_Home__c='Not Applicable'; 253 } 254 IF(Plan.Armada_Plan_Package_Name__c == 'Gold' && 255 Plan.Sum_of_Benefits__c ==0) 256 { 257 Plan.Annual_Family_Maximum__c=25000; 258 Plan.Annual_Single_Maximum__c=25000; 259 Plan.Vision__c=500; 260 Plan.Dental__c=2000; 261 Plan.RX__c=1500; 262 Plan.Counseling__c=1000; 263 Plan.Wellness__c=500; 264 Plan.Medical_Equipment__c=1000; 265 Plan.Executive_Physical__c=1000; 266 Plan.Medical_Expense_Coverage__c='All 213 Eligible'; 267 Plan.Deductible__c=0; 268 Plan.Co_insurance__c=0; 269 Plan.TopDoc_Connect__c='Not Applicable'; 270 Plan.Take_Me_Home__c='Not Applicable'; 271 } 272 IF(Plan.Armada_Plan_Package_Name__c == 'Platinum' && 273 Plan.Sum_of_Benefits__c ==0) 274 { 275 Plan.Annual_Family_Maximum__c=50000; 276 Plan.Annual_Single_Maximum__c=50000; 277 Plan.Vision__c=1000; 278 Plan.Dental__c=4000; 279 Plan.RX__c=2500; 280 Plan.Counseling__c=2000; 281 Plan.Wellness__c=1000; 282 Plan.Medical_Equipment__c=2500; 283 Plan.Executive_Physical__c=2000; 284 Plan.Medical_Expense_Coverage__c='All 213 Eligible'; 285 Plan.Deductible__c=0; 286 Plan.Co_insurance__c=0; 287 Plan.TopDoc_Connect__c='Not Applicable'; 288 Plan.Take_Me_Home__c='Not Applicable'; 289 } 290 IF(Plan.Armada_Plan_Package_Name__c == 'Diamond Plus' && 291 Plan.Sum_of_Benefits__c ==0) 292 { 293 Plan.Annual_Family_Maximum__c=100000; 294 Plan.Annual_Single_Maximum__c=100000; 295 Plan.Vision__c=10000; 296 Plan.Dental__c=10000; 297 Plan.RX__c=10000; 298 Plan.Counseling__c=10000; 299 Plan.Wellness__c=10000; 300 Plan.Medical_Equipment__c=10000; 301 Plan.Executive_Physical__c=10000; 302 Plan.Medical_Expense_Coverage__c='All 213 Eligible'; 303 Plan.Deductible__c=0; 304 Plan.Co_insurance__c=0; 305 Plan.TopDoc_Connect__c='Not Applicable'; 306 Plan.Take_Me_Home__c='Not Applicable'; 307 } 308 IF(Plan.Armada_Plan_Package_Name__c == '2000' && 309 Plan.Sum_of_Benefits__c ==0) 310 { 311 Plan.Annual_Family_Maximum__c=2000; 312 Plan.Annual_Single_Maximum__c=2000; 313 Plan.Vision__c=2000; 314 Plan.Dental__c=2000; 315 Plan.RX__c=2000; 316 Plan.Counseling__c=2000; 317 Plan.Wellness__c=2000; 318 Plan.Medical_Equipment__c=2000; 319 Plan.Executive_Physical__c=0; 320 Plan.Medical_Expense_Coverage__c='All 213 Eligible'; 321 Plan.Deductible__c=0; 322 Plan.Co_insurance__c=0; 323 Plan.TopDoc_Connect__c='Not Applicable'; 324 Plan.Take_Me_Home__c='Not Applicable'; 325 } 326 IF(Plan.Armada_Plan_Package_Name__c == '4000' && 327 Plan.Sum_of_Benefits__c ==0) 328 { 329 Plan.Annual_Family_Maximum__c=4000; 330 Plan.Annual_Single_Maximum__c=4000; 331 Plan.Vision__c=4000; 332 Plan.Dental__c=4000; 333 Plan.RX__c=4000; 334 Plan.Counseling__c=4000; 335 Plan.Wellness__c=4000; 336 Plan.Medical_Equipment__c=4000; 337 Plan.Executive_Physical__c=0; 338 Plan.Medical_Expense_Coverage__c='All 213 Eligible'; 339 Plan.Deductible__c=0; 340 Plan.Co_insurance__c=0; 341 Plan.TopDoc_Connect__c='Not Applicable'; 342 Plan.Take_Me_Home__c='Not Applicable'; 343 } 344 345 346 //AH Summary of Benefits. 347 348 IF(Plan.Armada_Plan_Package_Name__c == 'TopDoc Connect'&& 349 Plan.Product_Name__c=='TD'&& 350 Plan.TopDoc_Connect__c==NULL) 351 { 352 Plan.TopDoc_connect__c='Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'; 353 Plan.Take_Me_Home__c=' '; 354 Plan.Annual_Family_Maximum__c=0; 355 Plan.Annual_Single_Maximum__c=0; 356 Plan.Vision__c=0; 357 Plan.Dental__c=0; 358 Plan.RX__c=0; 359 Plan.Counseling__c=0; 360 Plan.Wellness__c=0; 361 Plan.Medical_Equipment__c=0; 362 Plan.Executive_Physical__c=0; 363 Plan.Medical_Expense_Coverage__c='Not Applicable'; 364 Plan.Deductible__c=0; 365 Plan.Co_insurance__c=0; 366 } 367 IF(Plan.Armada_Plan_Package_Name__c=='Take Me Home'&& 368 Plan.Product_Name__c=='TD'&& 369 Plan.TopDoc_Connect__c==NULL) 370 { 371 Plan.TopDoc_connect__c='Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'; 372 Plan.Take_Me_Home__c='Travel Portal;Travel Assistance;Paid Medical Evacuation'; 373 Plan.Annual_Family_Maximum__c=0; 374 Plan.Annual_Single_Maximum__c=0; 375 Plan.Vision__c=0; 376 Plan.Dental__c=0; 377 Plan.RX__c=0; 378 Plan.Counseling__c=0; 379 Plan.Wellness__c=0; 380 Plan.Medical_Equipment__c=0; 381 Plan.Executive_Physical__c=0; 382 Plan.Medical_Expense_Coverage__c='Not Applicable'; 383 Plan.Deductible__c=0; 384 Plan.Co_insurance__c=0; 385 } 386 IF(Plan.Armada_Plan_Package_Name__c=='Global Assistance'&& 387 Plan.Product_Name__c=='TD'&& 388 Plan.TopDoc_Connect__c==NULL) 389 { 390 Plan.TopDoc_connect__c='Clinically Guided Navigations;Facilitated Access;Covered Scope: Full'; 391 Plan.Take_Me_Home__c='Travel Portal;Travel Assistance'; 392 Plan.Annual_Family_Maximum__c=0; 393 Plan.Annual_Single_Maximum__c=0; 394 Plan.Vision__c=0; 395 Plan.Dental__c=0; 396 Plan.RX__c=0; 397 Plan.Counseling__c=0; 398 Plan.Wellness__c=0; 399 Plan.Medical_Equipment__c=0; 400 Plan.Executive_Physical__c=0; 401 Plan.Medical_Expense_Coverage__c='Not Applicable'; 402 Plan.Deductible__c=0; 403 Plan.Co_insurance__c=0; 404 } 405 IF(Plan.Armada_Plan_Package_Name__c=='Take Me Home'&& 406 Plan.Product_Name__c=='TR'&& 407 Plan.TopDoc_Connect__c==NULL) 408 { 409 Plan.TopDoc_connect__c=''; 410 Plan.Take_Me_Home__c='Travel Portal;Travel Assistance;Paid Medical Evacuation'; 411 Plan.Annual_Family_Maximum__c=0; 412 Plan.Annual_Single_Maximum__c=0; 413 Plan.Vision__c=0; 414 Plan.Dental__c=0; 415 Plan.RX__c=0; 416 Plan.Counseling__c=0; 417 Plan.Wellness__c=0; 418 Plan.Medical_Equipment__c=0; 419 Plan.Executive_Physical__c=0; 420 Plan.Medical_Expense_Coverage__c='Not Applicable'; 421 Plan.Deductible__c=0; 422 Plan.Co_insurance__c=0; 423 } 424 IF(Plan.Armada_Plan_Package_Name__c=='Global Assistance'&& 425 Plan.Product_Name__c=='TR'&& 426 Plan.TopDoc_Connect__c==NULL) 427 { 428 Plan.TopDoc_connect__c=''; 429 Plan.Take_Me_Home__c='Travel Portal;Travel Assistance'; 430 Plan.Annual_Family_Maximum__c=0; 431 Plan.Annual_Single_Maximum__c=0; 432 Plan.Vision__c=0; 433 Plan.Dental__c=0; 434 Plan.RX__c=0; 435 Plan.Counseling__c=0; 436 Plan.Wellness__c=0; 437 Plan.Medical_Equipment__c=0; 438 Plan.Executive_Physical__c=0; 439 Plan.Medical_Expense_Coverage__c='Not Applicable'; 440 Plan.Deductible__c=0; 441 Plan.Co_insurance__c=0; 442 443 444 445 446 } 447 448 } 449 450 }
- Zach Ackerman
- November 22, 2016
- Like
- 0
Infinity Symbol
I have a fields I populate with apex code that are percentages/currency. They are populated based on the type of plan it is. In some cases the value to be associated with the fields are infinity. Is there anyway I can use the inifity symbol in the curreny/percentage field? I attempted to build this into the code and it said "Error: Compile Error: Illegal assignment from String to Decimal at line 243 column 9". Any help would be greatly appreciated.
- Zach Ackerman
- October 24, 2016
- Like
- 0
Test Class Coverage not at 100%
I am having trouble getting my test class to 100% currently it is at 24%.
@isTest
public class PlanPackageNamesTest
{
static testMethod void myUnitTest()
{
Plan__c plan = new Plan__c();
plan.Name='Ultimate Health Diamond';
plan.Product_Name__c='UH';
plan.Carrier_Vendor__c='Transamerica';
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
plan.armada_plan_package_name__c='Diamond';
plan.Policy_Group_Number__c='111';
plan.Plan_Division__c='000A';
plan.services_phone_number__c='1-888-8888'
insert plan;
plan.annual_single_maximum__c=110000;
plan.annual_family_maximum__c=110000;
plan.vision__c=11000;
plan.dental__c=11000;
plan.RX__c=11000;
plan.Counseling__c=11000;
plan.wellness__c=11000;
plan.medical_equipment__c=11000;
plan.executive_physical__c=11000;
update plan;
}
}
Below is my Trigger
Trigger PlanPackageNames on Plan__c (Before Insert,Before Update){
for (Plan__c Plan : Trigger.new){
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==227500){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c!=227500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c!=115000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==115000){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c!=57500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==57500){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c!=270000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==270000){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Gold' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=25000;
Plan.Annual_Single_Maximum__c=25000;
Plan.Vision__c=500;
Plan.Dental__c=2000;
Plan.RX__c=1500;
Plan.Counseling__c=1000;
Plan.Wellness__c=500;
Plan.Medical_Equipment__c=1000;
Plan.Executive_Physical__c=1000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Platinum' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=50000;
Plan.Annual_Single_Maximum__c=50000;
Plan.Vision__c=1000;
Plan.Dental__c=4000;
Plan.RX__c=2500;
Plan.Counseling__c=2000;
Plan.Wellness__c=1000;
Plan.Medical_Equipment__c=2500;
Plan.Executive_Physical__c=2000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond Plus' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=10000;
Plan.Dental__c=10000;
Plan.RX__c=10000;
Plan.Counseling__c=10000;
Plan.Wellness__c=10000;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=10000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
}
}
@isTest
public class PlanPackageNamesTest
{
static testMethod void myUnitTest()
{
Plan__c plan = new Plan__c();
plan.Name='Ultimate Health Diamond';
plan.Product_Name__c='UH';
plan.Carrier_Vendor__c='Transamerica';
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
plan.armada_plan_package_name__c='Diamond';
plan.Policy_Group_Number__c='111';
plan.Plan_Division__c='000A';
plan.services_phone_number__c='1-888-8888'
insert plan;
plan.annual_single_maximum__c=110000;
plan.annual_family_maximum__c=110000;
plan.vision__c=11000;
plan.dental__c=11000;
plan.RX__c=11000;
plan.Counseling__c=11000;
plan.wellness__c=11000;
plan.medical_equipment__c=11000;
plan.executive_physical__c=11000;
update plan;
}
}
Below is my Trigger
Trigger PlanPackageNames on Plan__c (Before Insert,Before Update){
for (Plan__c Plan : Trigger.new){
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==227500){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c!=227500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c!=115000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==115000){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c!=57500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==57500){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c!=270000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==270000){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Gold' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=25000;
Plan.Annual_Single_Maximum__c=25000;
Plan.Vision__c=500;
Plan.Dental__c=2000;
Plan.RX__c=1500;
Plan.Counseling__c=1000;
Plan.Wellness__c=500;
Plan.Medical_Equipment__c=1000;
Plan.Executive_Physical__c=1000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Platinum' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=50000;
Plan.Annual_Single_Maximum__c=50000;
Plan.Vision__c=1000;
Plan.Dental__c=4000;
Plan.RX__c=2500;
Plan.Counseling__c=2000;
Plan.Wellness__c=1000;
Plan.Medical_Equipment__c=2500;
Plan.Executive_Physical__c=2000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond Plus' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=10000;
Plan.Dental__c=10000;
Plan.RX__c=10000;
Plan.Counseling__c=10000;
Plan.Wellness__c=10000;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=10000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
}
}
- Zach Ackerman
- October 10, 2016
- Like
- 0
trigger works when it is only one if statement. does not work when i add the second.
trigger PlanPackageNames on Plan__c (Before Insert,Before Update)
{
for (Plan__c Plan : Trigger.new)
{
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c==90000)
{Plan.Name= 'Ultimate Health'+' '+'Diamond';
{
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c!=90000)
{Plan.Name= 'Ultimate Health'+' '+'Modified'+'Diamond';
}
}
}
}
}
- Zach Ackerman
- October 07, 2016
- Like
- 0
Expression cannot be assigned at line -1 column -1
Essentially if the product name is UH I want the plan package name to be set using Ultimate Health a space and the field armada plan package name.
trigger PlanPackageNames on Plan__c (Before Insert) {
for (Plan__c Plan__c : Trigger.new)
{
IF(Plan__c.Product_Name__c=='UH')
{
Plan__c.Name='Ultimate Health'+' '+Plan__c.Armada_Plan_Package_Name__c;
}
}
}
trigger PlanPackageNames on Plan__c (Before Insert) {
for (Plan__c Plan__c : Trigger.new)
{
IF(Plan__c.Product_Name__c=='UH')
{
Plan__c.Name='Ultimate Health'+' '+Plan__c.Armada_Plan_Package_Name__c;
}
}
}
- Zach Ackerman
- October 05, 2016
- Like
- 0
Update Opportunity Field Based on Contact Role.
I want to update a custom field Original_Campaign__c on the opportunity. I want to populate that field with the contact roles Original_Campaign__c. Below is what I have, but it is not populateing the information.
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
trigger OpportunityOriginalCampaignUpdate on Opportunity (after insert, after update) {
List<Contact> conList = new List<Contact>();
OpportunityContactRole ContactRoles = [select OpportunityID, ContactID from OpportunityContactRole where OpportunityID =: trigger.old];
Contact con =[Select Original_Campaign__c from Contact where id=: ContactRoles.ContactId];
Opportunity opp = [Select Original_Campaign__c from Opportunity where id =: ContactRoles.OpportunityID];
opp.Original_Campaign__c = con.Original_Campaign__c;
}
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
trigger OpportunityOriginalCampaignUpdate on Opportunity (after insert, after update) {
List<Contact> conList = new List<Contact>();
OpportunityContactRole ContactRoles = [select OpportunityID, ContactID from OpportunityContactRole where OpportunityID =: trigger.old];
Contact con =[Select Original_Campaign__c from Contact where id=: ContactRoles.ContactId];
Opportunity opp = [Select Original_Campaign__c from Opportunity where id =: ContactRoles.OpportunityID];
opp.Original_Campaign__c = con.Original_Campaign__c;
}
- Zach Ackerman
- May 11, 2016
- Like
- 0
Data.com Formating Trigger
I am trying to properly format the data.com phone entry. I want the update to format the number as (555) 555-1212 when the user editing is autocln. I think I am partially therre, but missing something.
{
// Fix Phone Number Formating +1.555.555.1212 to (555) 555-1212
if((lead.Phone.startsWith('+1.')) && (l$User.Alias == "autocln"))
{
lead.Phone = lead.Phone.substring(3);
lead.Phone = lead.Phone.replace('.', '-');
lead.Phone = lead.Phone.replaceFirst('(^[0-9][0-9][0-9]).','($1) ');
}
//lead.Phone = lead.Phone.replace('.', '-');
}
}
{
// Fix Phone Number Formating +1.555.555.1212 to (555) 555-1212
if((lead.Phone.startsWith('+1.')) && (l$User.Alias == "autocln"))
{
lead.Phone = lead.Phone.substring(3);
lead.Phone = lead.Phone.replace('.', '-');
lead.Phone = lead.Phone.replaceFirst('(^[0-9][0-9][0-9]).','($1) ');
}
//lead.Phone = lead.Phone.replace('.', '-');
}
}
- Zach Ackerman
- April 13, 2016
- Like
- 0
Overlap Trigger for related list.
I have a related list on the account object called Broker_Commission_Code__c. I want to ensure that broker commission codes do not overlap. I need a trigger that will check for that specific account what broker code records exist and what their effective_date__c and termination_date__c. An example would be record 1 effective date = 1/1/16 and term date = 1/31/2016 Record 2 Effective date= 1/1/2016. I would need the trigger to stop from the second record being created with that date. The earliest the second record could exist is 2/1/2016.
Thanks!
Thanks!
- Zach Ackerman
- February 15, 2016
- Like
- 0
Pagination Class for Tasks
I have the following pagination code/vf page. I am getting an error that says 'List controllers are not supported for Task '. How can I update the code to make the visualforce page work?
Apex:
VisualForce:
Apex:
public class PaginationTaskHomePage1{ public String soql {get;set;} public List <Task> TaskList1 = New List <Task>(); public String soqlsort {get;set;} public List <Task> TaskList2= New List <Task>(); Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public List <Task> getTaskList() { return con.getRecords(); } public Apexpages.StandardSetController con{ get{ if(con==null){ size=500; string OwnersId = userinfo.getUserId() ; string type1 = 'Lost NB Round 1'; string type2 = 'Lost Renewals'; soqlsort='Select Subject,WhoID,WhatId,OwnerId,Opportunity_Effective_Date__c,Primary_Medical_Effective_Date__c,Type,CreatedDate From Task Where OwnerId = :OwnersId AND (Type = :type1 OR Type= :type2)'; TaskList1 = Database.query(soqlsort + ' Order by ' + sortField +' ' + sortDir); con= new ApexPages.StandardSetController(TaskList1); con.setPageSize(size); noOfRecords=Con.getResultSize(); } return con; } set; } public Boolean hasNext { get { return con.getHasNext(); } set; } //indicates whether therre are more records before the current page set. public Boolean hasPrevious{ get{ return con.getHasPrevious(); } set; } public Integer pageNumber { get{ return con.getPageNumber(); } set; } public void next(){ con.next(); } //returns the PageRerfernce of the original page, if known, or home page. public void cancel() { con.cancel(); } // Method for Constructor is used for Test Class public PaginationTaskHomePage1() { } //Toggles the sorting of query from asc to desc public void toggleSort() { //simply toggle the direction sortDir= sortDir.equals('asc') ? 'desc' : 'asc'; //run the query again for sorting other columns string OwnersId = userinfo.getUserId() ; string type1 = 'Lost NB Round 1'; string type2 = 'Lost Renewals'; soqlsort = 'Select Subject,WhoID,WhatId,OwnerId,Opportunity_Effective_Date__c,Primary_Medical_Effective_Date__c,Type,CreatedDate From Task Where OwnerId = :OwnersId AND (Type = :type1 OR Type= :type2)'; //adding string array to a List array TaskList2 = Database.query(soqlsort + ' Order by ' + sortField + ' ' + sortDir); // Adding Caselist to standard Pagination controller variable con= new ApexPages.StandardSetController(TaskList2); //Set Page Size to 500 con.setPageSize(500); } //the current sort direction defaults to asc public String sortDir{ //To set a direction either in ascending order or descending order. get{if(sortDir==null){sortDir = 'asc';} return sortDir;} set; } //the current field to sort by. defaults to probability public String sortField{ //to set a field sorting. get{if (sortField==null){sortField='Opportunity_Effective_Date__c';} return sortField;} set; } public pageReference refresh() { Con = null; getTaskList(); Con.setPageNumber(1); return null; } }
VisualForce:
<apex:page controller="PaginationTaskHomePage1" tabstyle="Task"> <apex:form > <apex:pageBlock id="pb"> <apex:sectionHeader title="{!$User.FirstName}'s Lost Renewal & New Business List"/> <apex:commandButton value="New Opportunity" onClick="window.open('https://cs15.salesforce.com/006/e?retURL=%2F006%2Fo&RecordType=01240000000Uexl&ent=Opportunity');"/> <apex:commandButton value="Detailed Report" onClick="window.open('https://cs15.salesforce.com/00Oe0000000fRSG');"/> <apex:pageBlockTable value="{!TaskList}" var="o" id="myTable"> <apex:column > <apex:facet name="header"> <apex:commandLink value="Subject" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Subject" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputlink value="/{!o.subject}" target="__blank">{!o.subject}</apex:outputlink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="WhoID" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="WhoId" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.WhoId}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="WhatId" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="WhatId" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.WhatId}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="OwnerId" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="OwnerId" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputlink value="/{!o.OwnerId}" target="__blank">{!o.OwnerId}</apex:outputlink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Opportunity_Effective_Date__c" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Opportunity_Effective_Date__c" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Opportunity_Effective_Date__c}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Primary_Medical_Effective_Date__c" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Primary_Medical_Effective_Date__c" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Primary_Medical_Effective_Date__c}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Type" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="Type" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.Type}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Create Date" action="{!toggleSort}" reRender="pb"> <apex:param name="sortField" value="CreatedDate" assignTo="{!sortField}" /> </apex:commandLink> </apex:facet> <apex:outputField value="{!o.CreatedDate}" /> </apex:column> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!Con.first}" disabled="{!!Con.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!Con.previous}" disabled="{!!Con.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!Con.next}" disabled="{!!Con.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!Con.last}" disabled="{!!Con.hasNext}" title="Last Page"/> <apex:outputText >{!(Con.pageNumber * size)+1-size}-{!IF((Con.pageNumber * size)>noOfRecords, noOfRecords,(Con.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>
- Zach Ackerman
- February 27, 2017
- Like
- 0
VF Sorting
I have the following code and visualforce. I wanted to give users the ability to click on the column headers to allow them to sort the table. Is this possible? I've seen a few things online, but was unable to get it to work with pagination.
Apex:
Visual Force
Apex:
public with sharing class Pagination_min { Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public ApexPages.StandardSetController setCon { get{ if(setCon == null){ size = 500; string OwnersId = userinfo.getUserId() ; string Rectypeid = '01240000000Uexl'; string Rectypeid2 = '01240000000cnJS'; string queryString = 'Select Name, StageName,FED__c,Broker__c,Broker_Name__c,Core_Product__c,LeadSource,Number_Quoted__c,CreatedDate FROM Opportunity Where OwnerId = :OwnersId AND IsClosed = False AND (RecordTypeId = :Rectypeid OR RecordTypeId= :RecTypeId2) order by Probability,FED__c asc'; setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString)); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; }set; } Public List<Opportunity> getOpps(){ List<Opportunity> oppList = new List<Opportunity>(); for(Opportunity o : (List<Opportunity>)setCon.getRecords()) oppList.add(o); return oppList; } public pageReference refresh() { setCon = null; getOpps(); setCon.setPageNumber(1); return null; } }
Visual Force
<apex:page controller="Pagination_min"> <apex:sectionHeader title="My Opportunity List"/> <apex:form > <apex:commandButton value="New Opportunity" onClick="window.open('https://cs15.salesforce.com/006/e?retURL=%2F006%2Fo&RecordType=01240000000Uexl&ent=Opportunity');"/> <apex:commandButton value="Detailed Report" onClick="window.open('https://cs15.salesforce.com/00Oe0000000fRSG');"/> <apex:pageBlock id="pb"> <apex:pageBlockTable value="{!opps}" var="o"> <apex:column headerValue="Opportunity Name"> <apex:outputlink value="/{!o.id}" target="__blank">{!o.Name}</apex:outputlink> </apex:column> <apex:column value="{!o.StageName}"/> <apex:column headerValue="Effective Date" value="{!o.FED__c}"/> <apex:column headerValue="Broker Name"> <apex:outputlink value="/{!o.Broker__c}" target="__blank">{!o.Broker_Name__c}</apex:outputlink> </apex:column> <apex:column value="{!o.Core_Product__c}"/> <apex:column value="{!o.LeadSource}"/> <apex:column value="{!o.Number_Quoted__c}"/> <apex:column value="{!o.CreatedDate}"/> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>
- Zach Ackerman
- February 14, 2017
- Like
- 0
Visualforce new window and column sorting
I have the following apex and visualforce.
I have added a commandbutton at the top of the visualforce page, but i want the click to open in a new window. Right now it is opening in the VF window.
I also want to have the ability to let the user sort the columns by clicking on the column header.
VisualForce
I have added a commandbutton at the top of the visualforce page, but i want the click to open in a new window. Right now it is opening in the VF window.
I also want to have the ability to let the user sort the columns by clicking on the column header.
VisualForce
<apex:page controller="Pagination_min"> <apex:form > <apex:commandButton value="New Opportunity" action="https://cs15.salesforce.com/006/e?retURL=%2F006%2Fo&RecordType=01240000000Uexl&ent=Opportunity"/> <apex:pageBlock id="pb"> <apex:pageBlockTable value="{!opps}" var="o"> <apex:column headerValue="Opportunity Name"> <apex:outputlink value="/{!o.id}" target="__blank">{!o.Name}</apex:outputlink> </apex:column> <apex:column value="{!o.StageName}"/> <apex:column value="{!o.FED__c}"/> <apex:column headerValue="Broker"> <apex:outputlink value="/{!o.Broker__c}" target="__blank">{!o.Broker_Name__c}</apex:outputlink> </apex:column> <apex:column value="{!o.Core_Product__c}"/> <apex:column value="{!o.LeadSource}"/> <apex:column value="{!o.Number_Quoted__c}"/> <apex:column value="{!o.CreatedDate}"/> </apex:pageBlockTable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageBlock> </apex:form> </apex:page>Apex
public with sharing class Pagination_min { Public Integer noOfRecords{get; set;} Public Integer size{get;set;} public ApexPages.StandardSetController setCon { get{ if(setCon == null){ size = 500; string OwnersId = userinfo.getUserId() ; string Rectypeid = '01240000000Uexl'; string Rectypeid2 = '01240000000cnJS'; string queryString = 'Select Name, StageName,FED__c,Broker__c,Broker_Name__c,Core_Product__c,LeadSource,Number_Quoted__c,CreatedDate FROM Opportunity Where OwnerId = :OwnersId AND IsClosed = False AND (RecordTypeId = :Rectypeid OR RecordTypeId= :RecTypeId2) order by FED__c'; setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString)); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; }set; } Public List<Opportunity> getOpps(){ List<Opportunity> oppList = new List<Opportunity>(); for(Opportunity o : (List<Opportunity>)setCon.getRecords()) oppList.add(o); return oppList; } public pageReference refresh() { setCon = null; getOpps(); setCon.setPageNumber(1); return null; } }
- Zach Ackerman
- February 12, 2017
- Like
- 0
List View VFPage
I have created a VF Page of an opportunity list view. One of the fields is Opportunity Name. When you click the name it opens the record in the VFPage. Can I modify the code to open a new tab when the opportunity is clicked?
<apex:page sidebar="false">
<apex:enhancedlist height="450" listid="00Be0000001eBaB" rowsperpage="100">;
</apex:enhancedlist></apex:page>
<apex:page sidebar="false">
<apex:enhancedlist height="450" listid="00Be0000001eBaB" rowsperpage="100">;
</apex:enhancedlist></apex:page>
- Zach Ackerman
- February 09, 2017
- Like
- 0
Sum multiple fields
I wanted to create a formula to sum fields. Right now this is the formula I have.
(IF(Opportunity.UH_Covered_Lives__c:SUM> 0,Opportunity.Final_Sold_Lives__c:SUM,+IF(Opportunity.UH_Covered_Lives__c:SUM<0,Opportunity.UH_Covered_Lives__c:SUM,0)))
I am attempting to SUM Final Sold Lives (FSL) in the event UH Covered Lives (UCL) is empty and then sum that number to the instances where UCL is not empty. Right now I'm only returning the total for FSL. The below example I would expect the total to be 31 not 11.
(IF(Opportunity.UH_Covered_Lives__c:SUM> 0,Opportunity.Final_Sold_Lives__c:SUM,+IF(Opportunity.UH_Covered_Lives__c:SUM<0,Opportunity.UH_Covered_Lives__c:SUM,0)))
I am attempting to SUM Final Sold Lives (FSL) in the event UH Covered Lives (UCL) is empty and then sum that number to the instances where UCL is not empty. Right now I'm only returning the total for FSL. The below example I would expect the total to be 31 not 11.
- Zach Ackerman
- December 14, 2016
- Like
- 0
Infinity Symbol
I have a fields I populate with apex code that are percentages/currency. They are populated based on the type of plan it is. In some cases the value to be associated with the fields are infinity. Is there anyway I can use the inifity symbol in the curreny/percentage field? I attempted to build this into the code and it said "Error: Compile Error: Illegal assignment from String to Decimal at line 243 column 9". Any help would be greatly appreciated.
- Zach Ackerman
- October 24, 2016
- Like
- 0
Test Class Coverage not at 100%
I am having trouble getting my test class to 100% currently it is at 24%.
@isTest
public class PlanPackageNamesTest
{
static testMethod void myUnitTest()
{
Plan__c plan = new Plan__c();
plan.Name='Ultimate Health Diamond';
plan.Product_Name__c='UH';
plan.Carrier_Vendor__c='Transamerica';
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
plan.armada_plan_package_name__c='Diamond';
plan.Policy_Group_Number__c='111';
plan.Plan_Division__c='000A';
plan.services_phone_number__c='1-888-8888'
insert plan;
plan.annual_single_maximum__c=110000;
plan.annual_family_maximum__c=110000;
plan.vision__c=11000;
plan.dental__c=11000;
plan.RX__c=11000;
plan.Counseling__c=11000;
plan.wellness__c=11000;
plan.medical_equipment__c=11000;
plan.executive_physical__c=11000;
update plan;
}
}
Below is my Trigger
Trigger PlanPackageNames on Plan__c (Before Insert,Before Update){
for (Plan__c Plan : Trigger.new){
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==227500){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c!=227500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c!=115000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==115000){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c!=57500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==57500){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c!=270000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==270000){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Gold' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=25000;
Plan.Annual_Single_Maximum__c=25000;
Plan.Vision__c=500;
Plan.Dental__c=2000;
Plan.RX__c=1500;
Plan.Counseling__c=1000;
Plan.Wellness__c=500;
Plan.Medical_Equipment__c=1000;
Plan.Executive_Physical__c=1000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Platinum' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=50000;
Plan.Annual_Single_Maximum__c=50000;
Plan.Vision__c=1000;
Plan.Dental__c=4000;
Plan.RX__c=2500;
Plan.Counseling__c=2000;
Plan.Wellness__c=1000;
Plan.Medical_Equipment__c=2500;
Plan.Executive_Physical__c=2000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond Plus' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=10000;
Plan.Dental__c=10000;
Plan.RX__c=10000;
Plan.Counseling__c=10000;
Plan.Wellness__c=10000;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=10000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
}
}
@isTest
public class PlanPackageNamesTest
{
static testMethod void myUnitTest()
{
Plan__c plan = new Plan__c();
plan.Name='Ultimate Health Diamond';
plan.Product_Name__c='UH';
plan.Carrier_Vendor__c='Transamerica';
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
plan.armada_plan_package_name__c='Diamond';
plan.Policy_Group_Number__c='111';
plan.Plan_Division__c='000A';
plan.services_phone_number__c='1-888-8888'
insert plan;
plan.annual_single_maximum__c=110000;
plan.annual_family_maximum__c=110000;
plan.vision__c=11000;
plan.dental__c=11000;
plan.RX__c=11000;
plan.Counseling__c=11000;
plan.wellness__c=11000;
plan.medical_equipment__c=11000;
plan.executive_physical__c=11000;
update plan;
}
}
Below is my Trigger
Trigger PlanPackageNames on Plan__c (Before Insert,Before Update){
for (Plan__c Plan : Trigger.new){
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==227500){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c!=227500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c!=115000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Platinum'&&
Plan.Sum_of_Benefits__c==115000){
Plan.Name= 'Ultimate Health'+' '+'Platinum';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c!=57500){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Gold'&&
Plan.Sum_of_Benefits__c==57500){
Plan.Name= 'Ultimate Health'+' '+'Gold';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c!=270000){
Plan.Name= 'Ultimate Health'+' '+'Modified'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==0){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c=='Diamond Plus'&&
Plan.Sum_of_Benefits__c==270000){
Plan.Name= 'Ultimate Health'+' '+'Diamond Plus';
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=1500;
Plan.Dental__c=5000;
Plan.RX__c=4000;
Plan.Counseling__c=3000;
Plan.Wellness__c=1500;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=2500;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Gold' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=25000;
Plan.Annual_Single_Maximum__c=25000;
Plan.Vision__c=500;
Plan.Dental__c=2000;
Plan.RX__c=1500;
Plan.Counseling__c=1000;
Plan.Wellness__c=500;
Plan.Medical_Equipment__c=1000;
Plan.Executive_Physical__c=1000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Platinum' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=50000;
Plan.Annual_Single_Maximum__c=50000;
Plan.Vision__c=1000;
Plan.Dental__c=4000;
Plan.RX__c=2500;
Plan.Counseling__c=2000;
Plan.Wellness__c=1000;
Plan.Medical_Equipment__c=2500;
Plan.Executive_Physical__c=2000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
IF(Plan.Armada_Plan_Package_Name__c == 'Diamond Plus' &&
Plan.Sum_of_Benefits__c ==0)
{
Plan.Annual_Family_Maximum__c=100000;
Plan.Annual_Single_Maximum__c=100000;
Plan.Vision__c=10000;
Plan.Dental__c=10000;
Plan.RX__c=10000;
Plan.Counseling__c=10000;
Plan.Wellness__c=10000;
Plan.Medical_Equipment__c=10000;
Plan.Executive_Physical__c=10000;
Plan.Medical_Expense_Coverage__c='All 213 Eligible';
Plan.Deductible__c=0;
Plan.Co_insurance__c=0;
}
}
}
- Zach Ackerman
- October 10, 2016
- Like
- 0
trigger works when it is only one if statement. does not work when i add the second.
trigger PlanPackageNames on Plan__c (Before Insert,Before Update)
{
for (Plan__c Plan : Trigger.new)
{
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c==90000)
{Plan.Name= 'Ultimate Health'+' '+'Diamond';
{
IF(Plan.Armada_Plan_Package_Name__c=='Diamond'&&
Plan.Sum_of_Benefits__c!=90000)
{Plan.Name= 'Ultimate Health'+' '+'Modified'+'Diamond';
}
}
}
}
}
- Zach Ackerman
- October 07, 2016
- Like
- 0
Expression cannot be assigned at line -1 column -1
Essentially if the product name is UH I want the plan package name to be set using Ultimate Health a space and the field armada plan package name.
trigger PlanPackageNames on Plan__c (Before Insert) {
for (Plan__c Plan__c : Trigger.new)
{
IF(Plan__c.Product_Name__c=='UH')
{
Plan__c.Name='Ultimate Health'+' '+Plan__c.Armada_Plan_Package_Name__c;
}
}
}
trigger PlanPackageNames on Plan__c (Before Insert) {
for (Plan__c Plan__c : Trigger.new)
{
IF(Plan__c.Product_Name__c=='UH')
{
Plan__c.Name='Ultimate Health'+' '+Plan__c.Armada_Plan_Package_Name__c;
}
}
}
- Zach Ackerman
- October 05, 2016
- Like
- 0
Overlap Trigger for related list.
I have a related list on the account object called Broker_Commission_Code__c. I want to ensure that broker commission codes do not overlap. I need a trigger that will check for that specific account what broker code records exist and what their effective_date__c and termination_date__c. An example would be record 1 effective date = 1/1/16 and term date = 1/31/2016 Record 2 Effective date= 1/1/2016. I would need the trigger to stop from the second record being created with that date. The earliest the second record could exist is 2/1/2016.
Thanks!
Thanks!
- Zach Ackerman
- February 15, 2016
- Like
- 0