- Andrew Echevarria
- NEWBIE
- 334 Points
- Member since 2015
- Salesforce Developer
- IBM
-
ChatterFeed
-
11Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
93Replies
After Update Trigger throwing error (DML error)
below is my trigger, I am trying to update a field when every a user try to update a state field as 'Michigan' then the Physical COuntry Field should automatically change to 'USA'. Please tell me where am i doing wrong.
Can i use Update dml statement for after update trigger. because
Below code is throwing error.
trigger fUpdate on Financial_Account__c (after update) {
List<Financial_Account__c> acc = [SELECT Id,name, physical_country__c FROM Financial_Account__c WHERE Id IN: Trigger.newMap.keySet()];
system.debug(''+acc);
for (Financial_Account__c a : acc) {
If(a.state__c == 'Michigan'){
a.physical_country__c = 'USA';
}
}
update acc;
}

Can i use Update dml statement for after update trigger. because
Below code is throwing error.
trigger fUpdate on Financial_Account__c (after update) {
List<Financial_Account__c> acc = [SELECT Id,name, physical_country__c FROM Financial_Account__c WHERE Id IN: Trigger.newMap.keySet()];
system.debug(''+acc);
for (Financial_Account__c a : acc) {
If(a.state__c == 'Michigan'){
a.physical_country__c = 'USA';
}
}
update acc;
}
-
- rv90
- January 30, 2017
- Like
- 0
- Continue reading or reply
conditional report
Hi
I have some historical records in account object where the Phone field in some records is less than 10 digits and in some records it is 10 digits.
I need to show in a report only those records whose Phone is exactly 10 digits and not less.
Pls let me know how to achieve this.
Thanks
Vandana
I have some historical records in account object where the Phone field in some records is less than 10 digits and in some records it is 10 digits.
I need to show in a report only those records whose Phone is exactly 10 digits and not less.
Pls let me know how to achieve this.
Thanks
Vandana
-
- vandana raju
- January 25, 2017
- Like
- 0
- Continue reading or reply
Rerender original page after creating record
I have a vf page with extension that creates some records on a custom object related to OpportunityLineItem. I need the page to close after the records are created, and then refresh the original OLI page to show the new record in the related list. I tried this but it doesn't refresh the page:
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<apex:actionFunction name="Rerender()" rerender="true" />
<script> function Return() {
window.close();
Rerender();
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
So I have this but it just returns the original page in my new window, if the user does this a few times they will end up with way too many windows open:
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<script> function Return() {
window.location.href = 'https://cs63.salesforce.com/'+'{!OpportunityLineItem.ID}'
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<apex:actionFunction name="Rerender()" rerender="true" />
<script> function Return() {
window.close();
Rerender();
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
So I have this but it just returns the original page in my new window, if the user does this a few times they will end up with way too many windows open:
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<script> function Return() {
window.location.href = 'https://cs63.salesforce.com/'+'{!OpportunityLineItem.ID}'
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
-
- Jean Grey 10
- January 24, 2017
- Like
- 0
- Continue reading or reply
Apex Test Class for FeedItem Issues
Hello Developers,
I'm having a lot of issues with creating an apex test class for the FeedItem apex trigger below. The trigger basically blocks all users from deleting attachments from Chatter Feed on the custom object (Documents Manager) expect the certain few users and profile. Any assistance creating the test class so we can deploy to production will be greatly appreciated!!
I'm having a lot of issues with creating an apex test class for the FeedItem apex trigger below. The trigger basically blocks all users from deleting attachments from Chatter Feed on the custom object (Documents Manager) expect the certain few users and profile. Any assistance creating the test class so we can deploy to production will be greatly appreciated!!
trigger ChatterDeleteBlocker on FeedItem (After Delete) { User u = [SELECT id, Name, ProfileId,Profile.Name FROM User WHERE id = :UserInfo.getUserId()]; for(FeedItem fi : trigger.old) { Document_Manager__c dm = new Document_Manager__c(); try { dm = [Select Id from Document_Manager__c where Id =:fi.ParentId]; } catch(Exception e) { dm = null; } if (dm != null) { if(fi.type == 'ContentPost' && (u.Profile.Name != 'System Administrator') && (u.Name != 'Bryan Girkins' && u.Name != 'Mary Loy' && u.Name != 'Judit Szilagyi' && u.Name != 'Sarah Swanson' && u.Name != 'Jeremy DalleTezze')) { fi.addError('You do not have the permissions to delete files from chatter feed'); } } } }
-
- XIO
- January 24, 2017
- Like
- 0
- Continue reading or reply
Visualforce Page display banner based on criteria
I have the code below and want to display the help text found right under my </style> tag based on what the user choosed as the Type.
Can anyone help how i can accomplish that?
Can anyone help how i can accomplish that?
<apex:page standardcontroller="Contract_Requests__c"> <apex:messages /> <apex:sectionheader title="{!$ObjectType.Contract_Requests__c.label} Edit" subtitle="{!IF(ISNULL(Contract_Requests__c.Name), 'New Contract Request',Contract_Requests__c.Name)}"/> <apex:form > <apex:pageblock mode="edit" title="{!$ObjectType.Contract_Requests__c.label} Edit"> <apex:pageblockbuttons > <apex:commandbutton value="Save" action="{!Save}"/> <apex:commandbutton value="Cancel" action="{!Cancel}"/> </apex:pageblockbuttons> <apex:pageBlockSection title="" showheader="false" columns="1"> <style type="text/css"> .divAlert0 { padding:2px; margin-left:auto; margin-right:auto; font-size:22px; height: 100%; width: 100%; text-align: center; background-color: #ADD8E6; font-family:'Arial'; } </style> <apex:outputPanel id="divtest0" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Work Order'}">Provide any existing contract, associated SOWs, etc. to be reviewed in the Notes field. If no additional information, enter None.</apex:outputPanel> <apex:outputPanel id="divTest1" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Amendment'}">Request Standard Amendment form. Please provide Terms and Conditions changes in the Notes field.</apex:outputPanel> <apex:outputPanel id="divTest2" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Statement of Work' || Contract_Requests__c.Type__c =='Subscription Schedule'}">Use Standard Templates if available. If none available, please request it here.</apex:outputPanel> <apex:outputPanel id="divtest3" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice'}">Provide Cancellation Noticed received from Customer and specifics that will be important in the Notes field.</apex:outputPanel> <apex:outputPanel id="divTest4" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='NDA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle NDA</apex:outputPanel> <apex:outputPanel id="divTest5" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='BAA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle BAA </apex:outputPanel> <apex:outputPanel id="divTest6" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Compliance Documentation' || Contract_Requests__c.Type__c =='Security Assessment') && (Contract_Requests__c.Documentation_Attached__c == 'No')}">Please attach the proper Documentation to this request. If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel> <apex:outputPanel id="divTest7" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Addendum' || Contract_Requests__c.Type__c =='Amendment' || Contract_Requests__c.Type__c =='Renewal Contract' || Contract_Requests__c.Type__c =='Subscription Schedule') && (Contract_Requests__c.Original_Contract_Attached__c == 'No')}">Please request the Contract from the Contract Administration and resubmit this request.</apex:outputPanel> <apex:outputPanel id="divtest8" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice' && Contract_Requests__c.Documentation_Attached__c == 'No'}">If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel> </apex:pageblockSection> <!-- ********** [Record Type : Master ] ********** --> <apex:outputpanel > <apex:pageblocksection title="Information" showheader="true" columns="2"> <apex:outputfield value="{!Contract_Requests__c.Name}"/> <apex:outputfield value="{!Contract_Requests__c.OwnerId}"/> <apex:inputfield value="{!Contract_Requests__c.Type__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Status__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Type_Detail__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Priority__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Notes__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Cancel_Reason__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Documentation_Attached__c}" required="true"/> <apex:pageblocksectionitem /> <apex:inputfield value="{!Contract_Requests__c.Original_Contract_Attached__c}" required="true"/> <apex:pageblocksectionitem /> </apex:pageblocksection> <apex:pageblocksection title="Customer Info" showheader="true" columns="2"> <apex:inputfield value="{!Contract_Requests__c.Lead__c}" required="false"/> <apex:pageblocksectionitem /> <apex:inputfield value="{!Contract_Requests__c.Account__c}" required="false"/> <apex:pageblocksectionitem /> <apex:inputfield value="{!Contract_Requests__c.Parent_Account__c}" required="false"/> <apex:pageblocksectionitem /> </apex:pageblocksection> <apex:pageblocksection title="Related Records" showheader="true" columns="2"> <apex:inputfield value="{!Contract_Requests__c.Contract__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Location__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Opportunity__c}" required="false"/> <apex:pageblocksectionitem /> <apex:inputfield value="{!Contract_Requests__c.Contact__c}" required="false"/> <apex:pageblocksectionitem /> </apex:pageblocksection> <apex:pageblocksection title="Additional Info" showheader="true" columns="2"> <apex:inputfield value="{!Contract_Requests__c.Renewal_Terms__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Service_Type__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Implmentation_Fee__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Service_Provided__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Pricing__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Service_Provided_Detail__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Responsible_for_Payment__c}" required="false"/> <apex:inputfield value="{!Contract_Requests__c.Services_to_be_Performed__c}" required="false"/> <apex:pageblocksectionitem /> <apex:inputfield value="{!Contract_Requests__c.Other_Addendum__c}" required="false"/> </apex:pageblocksection> </apex:outputpanel> </apex:pageblock> </apex:form> </apex:page>
-
- Sandra Ortiz
- January 24, 2017
- Like
- 0
- Continue reading or reply
Save button is not navigating ..?
public pagereference dosave(){ try { upsert objInvoices; } catch (DMLException dmlExcp) { ApexPages.addMessages(dmlExcp); } // PageReference redirectSuccess = new ApexPages.StandardController('/'+objInvoices.id).view(); // return (redirectSuccess); pageReference pr2=new pagereference('/'+objInvoices.id).setredirect(true); return pr2; }
-
- test batch
- January 24, 2017
- Like
- 0
- Continue reading or reply
Can i see underlying data in sales cloud graphical report?
Can i see underlying data in sales cloud pie or bar char report?
-
- Viraj M
- January 24, 2017
- Like
- 0
- Continue reading or reply
display of picklist values using inlise VF page for edit and detail page layout
Hello,
I want to display only 3 of 10 picklist to user without moficying record types.
Is it possible to do it by using VF page containing values of picklist ?
If possible i want to replace the picklist section with VF page in layout of edit and detail as well ..
thanks for suggestion !
I want to display only 3 of 10 picklist to user without moficying record types.
Is it possible to do it by using VF page containing values of picklist ?
If possible i want to replace the picklist section with VF page in layout of edit and detail as well ..
thanks for suggestion !
-
- Ab
- January 23, 2017
- Like
- 0
- Continue reading or reply
custom java button, 'is field null' syntax
Hi,
I am struggling to combine two validation rules on a custom java button in salesforce. I want the validation to check if a picklist value equals "procurement"and also that a number field is blank/null, if so display a message. Below is what I have which doesn't do aything because I do not know how to check for a null/blank value (it works if I stated the number field equals a specific number, just doesn't work if equals null).
if({!ISPICKVAL(Opportunity.Contract_Type__c, "Procurement") && Opportunity.Final_Price_Number__c == null}) {
alert('You need to enter the Final Price.............
Anyone can help, thanks..
I am struggling to combine two validation rules on a custom java button in salesforce. I want the validation to check if a picklist value equals "procurement"and also that a number field is blank/null, if so display a message. Below is what I have which doesn't do aything because I do not know how to check for a null/blank value (it works if I stated the number field equals a specific number, just doesn't work if equals null).
if({!ISPICKVAL(Opportunity.Contract_Type__c, "Procurement") && Opportunity.Final_Price_Number__c == null}) {
alert('You need to enter the Final Price.............
Anyone can help, thanks..
-
- Cushty
- July 29, 2016
- Like
- 0
- Continue reading or reply
Creating an Apex Trigger to update all records on a custom object
I am relatively new to Apex, and I need help with an Apex Trigger that updates all records on a custom object on a daily basis. The only criteria to not update the record is if "Status" picklist = "Contract Received". I assume you can use a simple for loop to set the criteria, and any help or assistance on the topic is greatly appreciated.
-
- Joshua Hric
- October 13, 2015
- Like
- 0
- Continue reading or reply
Mail not received - SingleEmailMessage
Hi
I'm trying to send mails to the owners of the Campaigns on certain conditions using SingleEmailMessage. While i could see no error in debug the mails seems not being recieved @ my inbox. Below the code snippet....any inputs to correct this or troubleshoot please?
public static void sendMail(List<Campaign> Campaigns){
for(Campaign camp:campaigns){
//New instance of a single email message
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
// Recipient
mail.setTargetObjectId(camp.CreatedById);
// Set the mail template
mail.setTemplateId('00X26000000DbPe');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setSaveAsActivity(false);
//mail.setWhatid(camp.Id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
I'm trying to send mails to the owners of the Campaigns on certain conditions using SingleEmailMessage. While i could see no error in debug the mails seems not being recieved @ my inbox. Below the code snippet....any inputs to correct this or troubleshoot please?
public static void sendMail(List<Campaign> Campaigns){
for(Campaign camp:campaigns){
//New instance of a single email message
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
// Recipient
mail.setTargetObjectId(camp.CreatedById);
// Set the mail template
mail.setTemplateId('00X26000000DbPe');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setSaveAsActivity(false);
//mail.setWhatid(camp.Id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
-
- PS81
- October 08, 2015
- Like
- 0
- Continue reading or reply
Generating PDF from Apex via PageReference
Hello all,
I'm calling an Apex class called AHelper from the Developer Console, that initializes the class and sets an variable. Next, I call a funciton to generate a PDF page using the same controller, but it seems that the PDF page's controller is re-initialized (local variable is reset to null).
The debug logs show this value is successfully set when I set it.
Apex class:
VF Page:
Execution:
Debug Log:
Help would be much appreciated, I've been stuck on this for weeks.
I'm calling an Apex class called AHelper from the Developer Console, that initializes the class and sets an variable. Next, I call a funciton to generate a PDF page using the same controller, but it seems that the PDF page's controller is re-initialized (local variable is reset to null).
The debug logs show this value is successfully set when I set it.
Apex class:
public class AHelper{ public String word; public String getTemplate(){ System.debug('returning template: ' + word); return word; } public Blob generatePDF(){ System.debug('generating: ' + word); PageReference pageRef = new PageReference('/apex/UnitCertGenerator'); pageRef.setRedirect(false); Blob PDF = pageRef.getContent(); return PDF; } }
VF Page:
<apex:page renderAs="pdf" cache="true" showHeader="false" sidebar="false" controller="AHelper" applyHtmlTag="false" applyBodyTag="false" > <head> <style> @page{ margin-top:1cm; margin-bottom:0cm; } </style> </head> <apex:outputPanel rendered="{!template != null}"> <apex:outputtext value="{!template}" escape="false" /> </apex:outputPanel> </apex:page>
Execution:
AHelper generator = new AHelper(); generator.word = 'hello, world'; generator.generatePDF();
Debug Log:
generating: hello, world returning template: null
Help would be much appreciated, I've been stuck on this for weeks.
-
- Andrew Echevarria
- September 19, 2017
- Like
- 0
- Continue reading or reply
Merging PDFs created into one PDF
I have a for loop that iterates over a list of Accounts and creates a PDF document for each account from an Email Template. These Attachments are inserted afterwards and the Id is saved into a field in the Account.
Is there a way to create one PDF document with all the documents created combined? Whether at the time the documents are created or afterwards via the list of Ids.
-
- Andrew Echevarria
- November 14, 2016
- Like
- 0
- Continue reading or reply
Salesforce1 Logging to Custom Object
On the Salesforce1 Mobile App I notice that "Call History" logs are matched with phone number on Contacts only. Is there a way to match the phone numbers to Custom Object records as well in order to log calls?
-
- Andrew Echevarria
- February 01, 2016
- Like
- 0
- Continue reading or reply
VisualForce Javascript get Blob object from inputFile
I have an inputFile field that the user can upload a file into (in this case, we are only using CSV files)
In the Javascript, I try to reference the uploaded CSV:
How can I make csvfile be the Blob uploaded?
<apex:inputFile id="csvfield" value="" />
In the Javascript, I try to reference the uploaded CSV:
var csvfile = document.getElementById('{!$Component.csvform:out:csvfield}').value;However, I'm not able to work with it because I'm not getting a Blob, but a String.
How can I make csvfile be the Blob uploaded?
-
- Andrew Echevarria
- November 02, 2015
- Like
- 0
- Continue reading or reply
SOQL WHERE Query using value from CSV file
I'm writing an Apex class that reads a CSV spreadsheet and inserts object records accordingly. I can confirm my program can read all the fields and create insert new records with the respective fields, but I'm having a problem when I try SOQL query an Object__c record using a value from the CSV file. I recieve an error telling me "caused by: System.QueryException: List has no rows for assignment to SObject".
So it's not finding the record when using the CSV value. However, when I hardcode the string into the SOQL query, it works.
String field = csvRow[4]); Object__c obj = [Select Id, Name from Object__c where Name =: field];
So it's not finding the record when using the CSV value. However, when I hardcode the string into the SOQL query, it works.
Object__c obj = [Select Id, Name from Object__c where Name = 'Test Object'];Please note that Object__c obj is a pre-existing object/record that exists prior to the execution of the Class so its existence is not dependent on any processes within the Class. Any assistance would be appreciated.
-
- Andrew Echevarria
- October 28, 2015
- Like
- 0
- Continue reading or reply
how to detect checkbox checked/unchecked on visualforce page
I have a visualforce page where I select student type of freshman and display highschool information fields (that works fine). But I want to hide the highschool country if the person checks the homeschooled checkbox. I can't seem to get that to work. I am trying to use javascript to hide the fields. Any help would be greatly appreciated.
vfp code:
<apex:page Controller="RFIForm" showHeader="false" standardStylesheets="FALSE">
<apex:includeScript value="{!$Resource.jQuery}"/>
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<script>
$(document).ready(function() {
HSReRender();
});
function HSReRender(){
var studentType = $("[id$=studentType]").val();
var HomeSchooled = $("[id$=homeSchooled]").val();
//$(".hsPanelH").hide();
alert(HomeSchooled);
if (studentType == "Freshman"){
$(".highSchoolPanelH").show();
if (HomeSchooled.checked){
$(".hsPanelH").hide();
alert('testing homeschooled checked');}
else{
$(".hsPanelH").show();
alert('testing homeschooled not checked');}
alert('testing freshman first');
} else {
$(".highSchoolPanelH").hide();
$(".hsPanelH").hide();
alert('testing freshman else first');
}
if ($(("#homeSchooled").is(":checked"))){
// if (studentType2 == "Freshman" && (HomeSchooled == null || HomeSchooled == false)){
$(".hsPanelH").hide();
alert('testing freshman and homeschooled checked');
} else if (studentType == "Freshman"){
$(".hsPanelH").show();
alert('testing just freshman');
} else {
$(".hsPanelH").hide();
alert('testing else');
}
}
</script>
<apex:pageMessages ></apex:pageMessages>
<apex:form Id="form">
<h1 id="page-title">Request for Information </h1>
<div style="width:100%">
<p>
<span class="contentText">Please enter your information in the fields below. When completed click on the <b>Submit</b> button at the bottom of page. Please allow 3 to 5 business days for processing your request for information.</span>
</p>
<p>
<span class="contentText"><strong>* Indicates a required field.</strong></span>
</p>
</div>
<table border="0" cellspacing="3" width="100%">
<tbody>
<tr>
<th colspan="2">Name and Personal Data</th>
</tr>
<tr>
<td width="37%"><apex:outputText styleclass="req" value="*Type of Student:"/></td>
<td width="63%">
<apex:selectList id="studentType" value="{!studentType}" multiselect="false" size="1" styleClass="inputRequired" onchange="HSReRender();">
<apex:selectOptions value="{!studentTypeOptions}"/>
<apex:actionSupport event="onchange" rerender="highSchoolPanel"/>
</apex:selectList>
</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="3" width="100%">
<tbody>
<tr class="highSchoolPanelH">
<th colspan="2" class="highSchoolPanelH">High School Information</th>
</tr>
<tr class="highSchoolPanelH">
<td width="37%" class="highSchoolPanelH">Home Schooled</td>
<td width="63%" class="highSchoolPanelH" onchange="HSReRender()">
<apex:inputCheckbox id="homeSchooled" value="{!interest.Home_Schooled__c}">
<apex:actionSupport event="onclick" rerender="highSchoolPanel"/>
</apex:inputCheckbox>
</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="3" width="100%" id="highSchoolPanel" rendered="{!studentType=='Freshman' && (interest.Home_Schooled__c==null || interest.Home_Schooled__c==false)}">
<tbody>
<tr class="hsPanelH" rendered="{!studentType=='Freshman' && (interest.Home_Schooled__c==null || interest.Home_Schooled__c==false)}">
<apex:outputText>
<td width="37%" class="hsPanelH" >*High School Country</td>
</apex:outputText>
<td width="63%" class="hsPanelH" rendered="{!studentType=='Freshman' && (interest.Home_Schooled__c==null || interest.Home_Schooled__c==false)}">
<apex:selectList id="hsPanelH" value="{!hscountry}" multiselect="False" size="1" styleClass="inputRequired">
<apex:selectOptions value="{!CountryOptions}"/>
<apex:actionSupport event="onchange" action="{!getHsStateRequired}" />
</apex:selectList>
</td>
</tr>
</tbody>
</table>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
vfp code:
<apex:page Controller="RFIForm" showHeader="false" standardStylesheets="FALSE">
<apex:includeScript value="{!$Resource.jQuery}"/>
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<script>
$(document).ready(function() {
HSReRender();
});
function HSReRender(){
var studentType = $("[id$=studentType]").val();
var HomeSchooled = $("[id$=homeSchooled]").val();
//$(".hsPanelH").hide();
alert(HomeSchooled);
if (studentType == "Freshman"){
$(".highSchoolPanelH").show();
if (HomeSchooled.checked){
$(".hsPanelH").hide();
alert('testing homeschooled checked');}
else{
$(".hsPanelH").show();
alert('testing homeschooled not checked');}
alert('testing freshman first');
} else {
$(".highSchoolPanelH").hide();
$(".hsPanelH").hide();
alert('testing freshman else first');
}
if ($(("#homeSchooled").is(":checked"))){
// if (studentType2 == "Freshman" && (HomeSchooled == null || HomeSchooled == false)){
$(".hsPanelH").hide();
alert('testing freshman and homeschooled checked');
} else if (studentType == "Freshman"){
$(".hsPanelH").show();
alert('testing just freshman');
} else {
$(".hsPanelH").hide();
alert('testing else');
}
}
</script>
<apex:pageMessages ></apex:pageMessages>
<apex:form Id="form">
<h1 id="page-title">Request for Information </h1>
<div style="width:100%">
<p>
<span class="contentText">Please enter your information in the fields below. When completed click on the <b>Submit</b> button at the bottom of page. Please allow 3 to 5 business days for processing your request for information.</span>
</p>
<p>
<span class="contentText"><strong>* Indicates a required field.</strong></span>
</p>
</div>
<table border="0" cellspacing="3" width="100%">
<tbody>
<tr>
<th colspan="2">Name and Personal Data</th>
</tr>
<tr>
<td width="37%"><apex:outputText styleclass="req" value="*Type of Student:"/></td>
<td width="63%">
<apex:selectList id="studentType" value="{!studentType}" multiselect="false" size="1" styleClass="inputRequired" onchange="HSReRender();">
<apex:selectOptions value="{!studentTypeOptions}"/>
<apex:actionSupport event="onchange" rerender="highSchoolPanel"/>
</apex:selectList>
</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="3" width="100%">
<tbody>
<tr class="highSchoolPanelH">
<th colspan="2" class="highSchoolPanelH">High School Information</th>
</tr>
<tr class="highSchoolPanelH">
<td width="37%" class="highSchoolPanelH">Home Schooled</td>
<td width="63%" class="highSchoolPanelH" onchange="HSReRender()">
<apex:inputCheckbox id="homeSchooled" value="{!interest.Home_Schooled__c}">
<apex:actionSupport event="onclick" rerender="highSchoolPanel"/>
</apex:inputCheckbox>
</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="3" width="100%" id="highSchoolPanel" rendered="{!studentType=='Freshman' && (interest.Home_Schooled__c==null || interest.Home_Schooled__c==false)}">
<tbody>
<tr class="hsPanelH" rendered="{!studentType=='Freshman' && (interest.Home_Schooled__c==null || interest.Home_Schooled__c==false)}">
<apex:outputText>
<td width="37%" class="hsPanelH" >*High School Country</td>
</apex:outputText>
<td width="63%" class="hsPanelH" rendered="{!studentType=='Freshman' && (interest.Home_Schooled__c==null || interest.Home_Schooled__c==false)}">
<apex:selectList id="hsPanelH" value="{!hscountry}" multiselect="False" size="1" styleClass="inputRequired">
<apex:selectOptions value="{!CountryOptions}"/>
<apex:actionSupport event="onchange" action="{!getHsStateRequired}" />
</apex:selectList>
</td>
</tr>
</tbody>
</table>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
- Darlene Blaney
- October 19, 2017
- Like
- 0
- Continue reading or reply
Contacts and Contact Group
Hi everyone! Does anyone know or familiar with how to create a relationship and functionality that would allow a contact to be related to a contact group directly from the contact record by means of a single field? I would also like to be able to add a single contact to multiple contact groups directly from a field. I've seen this work in other orgs and I am not familiar with how that could be built out.
Alternatively, would I be able to populate a field directly on the contact record with the contact group name once the contact has been added to the said group?
The purpose for this is to be able to leverage salesforce engage with our already establised contact groups.
Any advise would be great, thanks!
Alternatively, would I be able to populate a field directly on the contact record with the contact group name once the contact has been added to the said group?
The purpose for this is to be able to leverage salesforce engage with our already establised contact groups.
Any advise would be great, thanks!
- Autumn Yoakum1
- October 17, 2017
- Like
- 0
- Continue reading or reply
Progress Bar Showing Data on VF
Hello,
Does anyone has any experience implementing a Progress Bar with data information within it??
So my requirement is a progress bar which shows when the record was approved, approvers name , and then further steps..
Progress Bar >> Submitted to Govt >> Submitted by Hillary On 10th December >> Approved By Obama On 31st December >> Submitted to WH >> Submitted By Pence On 20th February >> Rejected by Trump On 21st January ... :)
Something like that.
Does any one know if this is possible.
And this has to be on display upon page load, and not like an On-click feature.
I know how to create VF progress bar representing percentage and status level, but I haven't ventured in displaying the actual data.
Any and every help will be appreciated.
Thanks!
Does anyone has any experience implementing a Progress Bar with data information within it??
So my requirement is a progress bar which shows when the record was approved, approvers name , and then further steps..
Progress Bar >> Submitted to Govt >> Submitted by Hillary On 10th December >> Approved By Obama On 31st December >> Submitted to WH >> Submitted By Pence On 20th February >> Rejected by Trump On 21st January ... :)
Something like that.
Does any one know if this is possible.
And this has to be on display upon page load, and not like an On-click feature.
I know how to create VF progress bar representing percentage and status level, but I haven't ventured in displaying the actual data.
Any and every help will be appreciated.
Thanks!
- Cloud Atlas
- February 03, 2017
- Like
- 0
- Continue reading or reply
How to display alert window in Visualforcepage Onload?
Hi All,
I have one custom ( vf page) button for generate quote in opportunity Detail Page. Click this button it generate a custom quote in pdf format.
In my Scenario, I click that quote button I want to check whether the quote object “IsSyncing" field is checked or not, If its not checked I want to display one alert for "sync Quote" I am using Professional Edition.
I have one custom ( vf page) button for generate quote in opportunity Detail Page. Click this button it generate a custom quote in pdf format.
In my Scenario, I click that quote button I want to check whether the quote object “IsSyncing" field is checked or not, If its not checked I want to display one alert for "sync Quote" I am using Professional Edition.
- Sivasankari Muthu
- February 03, 2017
- Like
- 0
- Continue reading or reply
want to update custom dependent picklist values using javascript
Hello,
I have two custom picklist on Account with respective values:
First Picklist
Bussiness Segment: VALUES{PACS, IA, SI}
&
Second Picklist
Applications : VALUES{ PACS-1, PACS-2, PACS-3, IA-1, IA-2, IA-3,} (No values for Segment SI)
Requirement :
Create VF page which will allow user to select Business segment and show available “Applications” based on the Business Segment using JavaScript.
Also, when no application is available for selected Business segment, then show alert message “Applications not available for business segment: Business Segment name” using JavaScript.
NOTE: Don't want to use any Extension or Custom controller. i.e. need to perform using JavaScript only.
First question: Is it possible through JS only?
Second question: what need to change in below JS code?
Currently, Second Picklist is not re-rendering.
Please help in this issue.
************************************VF PAGE**********************************************
<apex:page standardController="Account">
<script type="text/javascript">
function displayChildPickValues(selectPick){
var pickValue = selectPick.options[selectPick.selectedIndex].value;
if(pickValue == 'SI')alert('Applications not available for business segment: '+pickValue);
if(pickValue == 'PACS'){
for(var x in document.getElementsByClassName("second")[0].options){
var m = document.getElementsByClassName("second")[0].options[x].value;
if(!m.startsWith("P")){
if(!document.getElementsByClassName("second")[0].options[x].hasAttribute("style"))
document.getElementsByClassName("second")[0].options[x].setAttribute("style","hidden:true;");
}//End of IF
}//End of For
}//End of IF
secondPickFun(); //Calling actionFunction
}//End of javascript function
</script>
<apex:form >
<apex:pageblock >
<apex:pageblockSection >
<apex:inputField value="{!Account.Name}"/>
<apex:inputField value="{!Account.Business_Segment__c}" onchange="displayChildPickValues(this)">
<apex:actionFunction reRender="appPick" name="secondPickFun"/>
</apex:inputField>
<apex:inputField value="{!Account.Applications__c}" Styleclass="second" id="appPick"/>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
I have two custom picklist on Account with respective values:
First Picklist
Bussiness Segment: VALUES{PACS, IA, SI}
&
Second Picklist
Applications : VALUES{ PACS-1, PACS-2, PACS-3, IA-1, IA-2, IA-3,} (No values for Segment SI)
Requirement :
Create VF page which will allow user to select Business segment and show available “Applications” based on the Business Segment using JavaScript.
Also, when no application is available for selected Business segment, then show alert message “Applications not available for business segment: Business Segment name” using JavaScript.
NOTE: Don't want to use any Extension or Custom controller. i.e. need to perform using JavaScript only.
First question: Is it possible through JS only?
Second question: what need to change in below JS code?
Currently, Second Picklist is not re-rendering.
Please help in this issue.
************************************VF PAGE**********************************************
<apex:page standardController="Account">
<script type="text/javascript">
function displayChildPickValues(selectPick){
var pickValue = selectPick.options[selectPick.selectedIndex].value;
if(pickValue == 'SI')alert('Applications not available for business segment: '+pickValue);
if(pickValue == 'PACS'){
for(var x in document.getElementsByClassName("second")[0].options){
var m = document.getElementsByClassName("second")[0].options[x].value;
if(!m.startsWith("P")){
if(!document.getElementsByClassName("second")[0].options[x].hasAttribute("style"))
document.getElementsByClassName("second")[0].options[x].setAttribute("style","hidden:true;");
}//End of IF
}//End of For
}//End of IF
secondPickFun(); //Calling actionFunction
}//End of javascript function
</script>
<apex:form >
<apex:pageblock >
<apex:pageblockSection >
<apex:inputField value="{!Account.Name}"/>
<apex:inputField value="{!Account.Business_Segment__c}" onchange="displayChildPickValues(this)">
<apex:actionFunction reRender="appPick" name="secondPickFun"/>
</apex:inputField>
<apex:inputField value="{!Account.Applications__c}" Styleclass="second" id="appPick"/>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
- Pratik Pawar
- February 03, 2017
- Like
- 0
- Continue reading or reply
I want a trigger to populate the Case Owners "Managers" eMail
Hello,
I have been able to populate the record owners "Managers" e-mail on some objects using workflow but on the Case Object I get an error telling me we are out of resources. When I contacted SFDC Support they advised I do this with a Trigger, so I need some help for a newbe (me) trying to write a Trigger.
I have a custom field on the Case object Owners.Managers.eMail__c , I want a trigger that populates the Managers eMail in this field, I also want the Trigger to update the Managers eMail when the Case Owner changes.
I have been able to populate the record owners "Managers" e-mail on some objects using workflow but on the Case Object I get an error telling me we are out of resources. When I contacted SFDC Support they advised I do this with a Trigger, so I need some help for a newbe (me) trying to write a Trigger.
I have a custom field on the Case object Owners.Managers.eMail__c , I want a trigger that populates the Managers eMail in this field, I also want the Trigger to update the Managers eMail when the Case Owner changes.
- Brian Bartlett
- February 02, 2017
- Like
- 0
- Continue reading or reply
After Update Trigger throwing error (DML error)
below is my trigger, I am trying to update a field when every a user try to update a state field as 'Michigan' then the Physical COuntry Field should automatically change to 'USA'. Please tell me where am i doing wrong.
Can i use Update dml statement for after update trigger. because
Below code is throwing error.
trigger fUpdate on Financial_Account__c (after update) {
List<Financial_Account__c> acc = [SELECT Id,name, physical_country__c FROM Financial_Account__c WHERE Id IN: Trigger.newMap.keySet()];
system.debug(''+acc);
for (Financial_Account__c a : acc) {
If(a.state__c == 'Michigan'){
a.physical_country__c = 'USA';
}
}
update acc;
}

Can i use Update dml statement for after update trigger. because
Below code is throwing error.
trigger fUpdate on Financial_Account__c (after update) {
List<Financial_Account__c> acc = [SELECT Id,name, physical_country__c FROM Financial_Account__c WHERE Id IN: Trigger.newMap.keySet()];
system.debug(''+acc);
for (Financial_Account__c a : acc) {
If(a.state__c == 'Michigan'){
a.physical_country__c = 'USA';
}
}
update acc;
}
- rv90
- January 30, 2017
- Like
- 0
- Continue reading or reply
Email Alert before someone turns 40
Hi Experts,
I need to set up an email notification that will alert me when one of my contacts is turning 40!
i want it to be SPECIFICALLY 65 days prior to that date. i have an AGE field that has a formula to it of :
IF(MONTH(TODAY())>MONTH(Birthdate),YEAR(TODAY())-YEAR(Birthdate),IF(AND(MONTH(TODAY())=MONTH(Birthdate),DAY(TODAY())>=DAY(Birthdate)),YEAR(TODAY())-YEAR(Birthdate),(YEAR(TODAY())-YEAR(Birthdate))-1))
That formula brings me back the actual age of the contact from the persons Birthdate.
I know that to set up an email alert you have to do the Workflow and then the Email template.
But how do i set up an alert to trigger prior to someones birthdate etc.
Please help
I need to set up an email notification that will alert me when one of my contacts is turning 40!
i want it to be SPECIFICALLY 65 days prior to that date. i have an AGE field that has a formula to it of :
IF(MONTH(TODAY())>MONTH(Birthdate),YEAR(TODAY())-YEAR(Birthdate),IF(AND(MONTH(TODAY())=MONTH(Birthdate),DAY(TODAY())>=DAY(Birthdate)),YEAR(TODAY())-YEAR(Birthdate),(YEAR(TODAY())-YEAR(Birthdate))-1))
That formula brings me back the actual age of the contact from the persons Birthdate.
I know that to set up an email alert you have to do the Workflow and then the Email template.
But how do i set up an alert to trigger prior to someones birthdate etc.
Please help
- Hermes Gomez
- January 30, 2017
- Like
- 0
- Continue reading or reply
Is there any form to automate case creation so the field Account can be filled (Email To Case)?
Hi all,
here I am again with the same topic, this time for asking if there is a possibility to fill the field Account automatically at case creation when the email which comes from the Sender coincides with an existing email for that Account?.
For example, supposing Manuel Perez is registered as Account with email address in Salesforce. Manuel Perez sends an email to the Customer Support advocate. Salesforce should work this looking at every Account if there is an account with the email address of the sender, if yes, it should fill the field Account in the case record which is being created.
Is this possible some way?
here I am again with the same topic, this time for asking if there is a possibility to fill the field Account automatically at case creation when the email which comes from the Sender coincides with an existing email for that Account?.
For example, supposing Manuel Perez is registered as Account with email address in Salesforce. Manuel Perez sends an email to the Customer Support advocate. Salesforce should work this looking at every Account if there is an account with the email address of the sender, if yes, it should fill the field Account in the case record which is being created.
Is this possible some way?
- Jose María Nicolás Arfelis
- January 30, 2017
- Like
- 0
- Continue reading or reply
Not able to fetch report id through select query but getting it in anonymous apex
Hi All,
I am working on a requirement where i am using report ids i.e report ids are hardcoded.
Thanks,
Bharath
I am working on a requirement where i am using report ids i.e report ids are hardcoded.
<analytics:reportChart reportId="00O28000006Uvr3" size="small" ></analytics:reportChart>I need to get remove this hardcoding and get it from select query. How can i accomplish this?
Thanks,
Bharath
- bharath kumar 52
- January 30, 2017
- Like
- 0
- Continue reading or reply
In Visual force page- More button is not fetching records.
Hi,
I have a visual force page as shown below in which 'more' is redirect the user to details page of records. but for the block 'Task completed last week' more button is not working, for others it is working fine. any body can help
below is my vf page and controller:-
<div class="main_container" style="margin-top:10px">
<div class = "height:50%">
<div class="animated flipInY col-lg-4 col-md-80 col-sm-80 col-xs-80">
<div class="tile-stats">
<div style="text-align:center">
<apex:outputLabel value="Task Completed Last Week" style="color:#0A31FB;" />
</div>
<apex:pageBlock >
<apex:pageBlockTable value="{!rows}" var="tc" rows="3" rendered="{!rows.size>0}">
<apex:column >
<a href= "/{!tc.id}">
<!--apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, tc.id)}" styleClass="leftAlign" >-->{!tc.Name}</a>
<!--/apex:outputLink>-->
</apex:column>
</apex:pageBlockTable>
<!-- <apex:repeat>
dsd
<apex:outputText value="There are no tasks to display." style="white-space:pre-wrap;border-hidden" />
</apex:repeat>-->
</apex:pageBlock>
<apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskcom}"
/>
</div>
</div>
</div>
</div>
<div class="main_container" style="margin-top:10px">
<div class="animated flipInY col-lg-4 col-md-2 col-sm-6 col-xs-12">
<div class="tile-stats">
<div style="text-align:center">
<apex:outputLabel value="Task In Progress" style="color:#0A31FB;" />
</div>
<apex:pageBlock >
<apex:pageBlockTable value="{!taskname}" var="t" rows="3" rendered="{!taskname.size>0}">
<apex:column >
<a href= "/{!t.id}">
<!-- <apex:param name="tcIP" value="{!t.Id}" />
<apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, t.id)}" styleClass="leftAlign" >-->{!t.Name}</a>
<!--</apex:outputLink>-->
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskprj}"
/>
</div>
</div>
</div>
<div class="main_container" style="margin-top:10px">
<div class="row top_tiles" style="text-align:center;">
<div class="animated flipInY col-lg-4 col-md-2 col-sm-6 col-xs-12">
<div class="tile-stats">
<div style="text-align:center">
<apex:outputLabel value="Tasks starting next week" style="color:#0A31FB;" />
</div>
<apex:pageBlock >
<apex:outputPanel layout="block" styleclass="container">
<apex:pageBlockTable value="{!taskPlan}" var="tp" rows="3" rendered="{!taskPlan.size>0}">
<apex:column >
<a href= "/{!tp.id}">
<!--<apex:param name="tpId" value="{!tp.Id}" />
<apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, tp.id)}" styleClass="leftAlign" >-->{!tp.Name}</a>
<!--</apex:outputLink>-->
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlock>
<apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskpln}"
/>
</div>
</div>
</div>
</div>
Controller:-
List<CloudbyzITPM__Task__c> taskname = [SELECT Id,Name, CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'In Progress' and CloudbyzITPM__Project__r.Id =: recordId];
public List<CloudbyzITPM__Task__c> gettaskname(){
if(taskname.size() < 3 ){
for(integer i = 0; i <= (3 - taskname.size());){
taskname.add(new CloudbyzITPM__Task__c(Name = 'N/A'));
}
}
return taskname;
}
public void gettaskinprogress(){
if (!Schema.sObjectType.CloudbyzITPM__Task__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.id.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.name.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Milestone__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_Start_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_End_Date__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_End_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_Start_date__c.isAccessible())
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
'Insufficient access'));
return;
}
if(currentProjectId!=null)
currentProjectId=string.escapeSingleQuotes(currentProjectId);
lstoftasksPrg = [SELECT Id,Name, CloudbyzITPM__Status__c,CloudbyzITPM__Milestone__c,CloudbyzITPM__Planned_Start_Date__c,CloudbyzITPM__Planned_End_Date__c,CloudbyzITPM__Actual_Start_date__c,CloudbyzITPM__Actual_End_Date__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'In Progress' and CloudbyzITPM__Project__r.Id =: recordId];
}
public List<CloudbyzITPM__Task__c> getlstoftasksPrg(){
return lstoftasksPrg;
}
public pagereference redirecttoprjtskprj(){
return new pagereference('/apex/projecttaskprogress?id='+currentProjectId);
}
/* task in completed
List<CloudbyzITPM__Task__c> taskComp = [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c, CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId];
public list<CloudbyzITPM__Task__c> getRows()
{
List<CloudbyzITPM__Task__c> rows = [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c, CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId ];
system.debug('@@ rows of task' + rows);
List<CloudbyzITPM__Task__c> rows_temp = new List<CloudbyzITPM__Task__c>(rows);
rows.clear();
for(CloudbyzITPM__Task__c irrTask : rows_temp)
{
if(irrTask.Name.length()>10)
{
system.debug('@@ rows of task' + rows);
irrTask.Name = irrTask.Name.substring(0,10) + '...' ;
}
rows.add(irrTask);
}
(rows.size() < 3 ){
for(integer i = 0; i <= (3 - rows.size());){
rows.add(new CloudbyzITPM__Task__c(Name = 'N/A'));
}
}
return rows;
}
public void gettaskcompleted(){
System.debug('@@lstoftaskscmp@@');
if (!Schema.sObjectType.CloudbyzITPM__Task__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.id.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.name.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Milestone__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_Start_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_End_Date__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_End_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_Start_date__c.isAccessible())
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
'Insufficient access'));
return;
}
System.debug('@@currentProjectId@@'+currentProjectId);
if(currentProjectId!=null)
currentProjectId=string.escapeSingleQuotes(currentProjectId);
lstoftaskscmp = [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c,CloudbyzITPM__Milestone__c,CloudbyzITPM__Planned_Start_Date__c,CloudbyzITPM__Planned_End_Date__c ,CloudbyzITPM__Actual_Start_date__c,CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId];
}
public List<CloudbyzITPM__Task__c> getlstoftaskscmp()
{
System.debug('@@lstoftaskscmp@@'+lstoftaskscmp);
return lstoftaskscmp;
}
public pagereference redirecttoprjtskcom()
{
return new pagereference('/apex/projecttaskcomplete?id='+currentProjectId);
}
I have a visual force page as shown below in which 'more' is redirect the user to details page of records. but for the block 'Task completed last week' more button is not working, for others it is working fine. any body can help
below is my vf page and controller:-
<div class="main_container" style="margin-top:10px">
<div class = "height:50%">
<div class="animated flipInY col-lg-4 col-md-80 col-sm-80 col-xs-80">
<div class="tile-stats">
<div style="text-align:center">
<apex:outputLabel value="Task Completed Last Week" style="color:#0A31FB;" />
</div>
<apex:pageBlock >
<apex:pageBlockTable value="{!rows}" var="tc" rows="3" rendered="{!rows.size>0}">
<apex:column >
<a href= "/{!tc.id}">
<!--apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, tc.id)}" styleClass="leftAlign" >-->{!tc.Name}</a>
<!--/apex:outputLink>-->
</apex:column>
</apex:pageBlockTable>
<!-- <apex:repeat>
dsd
<apex:outputText value="There are no tasks to display." style="white-space:pre-wrap;border-hidden" />
</apex:repeat>-->
</apex:pageBlock>
<apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskcom}"
/>
</div>
</div>
</div>
</div>
<div class="main_container" style="margin-top:10px">
<div class="animated flipInY col-lg-4 col-md-2 col-sm-6 col-xs-12">
<div class="tile-stats">
<div style="text-align:center">
<apex:outputLabel value="Task In Progress" style="color:#0A31FB;" />
</div>
<apex:pageBlock >
<apex:pageBlockTable value="{!taskname}" var="t" rows="3" rendered="{!taskname.size>0}">
<apex:column >
<a href= "/{!t.id}">
<!-- <apex:param name="tcIP" value="{!t.Id}" />
<apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, t.id)}" styleClass="leftAlign" >-->{!t.Name}</a>
<!--</apex:outputLink>-->
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskprj}"
/>
</div>
</div>
</div>
<div class="main_container" style="margin-top:10px">
<div class="row top_tiles" style="text-align:center;">
<div class="animated flipInY col-lg-4 col-md-2 col-sm-6 col-xs-12">
<div class="tile-stats">
<div style="text-align:center">
<apex:outputLabel value="Tasks starting next week" style="color:#0A31FB;" />
</div>
<apex:pageBlock >
<apex:outputPanel layout="block" styleclass="container">
<apex:pageBlockTable value="{!taskPlan}" var="tp" rows="3" rendered="{!taskPlan.size>0}">
<apex:column >
<a href= "/{!tp.id}">
<!--<apex:param name="tpId" value="{!tp.Id}" />
<apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, tp.id)}" styleClass="leftAlign" >-->{!tp.Name}</a>
<!--</apex:outputLink>-->
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlock>
<apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskpln}"
/>
</div>
</div>
</div>
</div>
Controller:-
List<CloudbyzITPM__Task__c> taskname = [SELECT Id,Name, CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'In Progress' and CloudbyzITPM__Project__r.Id =: recordId];
public List<CloudbyzITPM__Task__c> gettaskname(){
if(taskname.size() < 3 ){
for(integer i = 0; i <= (3 - taskname.size());){
taskname.add(new CloudbyzITPM__Task__c(Name = 'N/A'));
}
}
return taskname;
}
public void gettaskinprogress(){
if (!Schema.sObjectType.CloudbyzITPM__Task__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.id.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.name.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Milestone__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_Start_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_End_Date__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_End_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_Start_date__c.isAccessible())
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
'Insufficient access'));
return;
}
if(currentProjectId!=null)
currentProjectId=string.escapeSingleQuotes(currentProjectId);
lstoftasksPrg = [SELECT Id,Name, CloudbyzITPM__Status__c,CloudbyzITPM__Milestone__c,CloudbyzITPM__Planned_Start_Date__c,CloudbyzITPM__Planned_End_Date__c,CloudbyzITPM__Actual_Start_date__c,CloudbyzITPM__Actual_End_Date__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'In Progress' and CloudbyzITPM__Project__r.Id =: recordId];
}
public List<CloudbyzITPM__Task__c> getlstoftasksPrg(){
return lstoftasksPrg;
}
public pagereference redirecttoprjtskprj(){
return new pagereference('/apex/projecttaskprogress?id='+currentProjectId);
}
/* task in completed
List<CloudbyzITPM__Task__c> taskComp = [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c, CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId];
public list<CloudbyzITPM__Task__c> getRows()
{
List<CloudbyzITPM__Task__c> rows = [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c, CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId ];
system.debug('@@ rows of task' + rows);
List<CloudbyzITPM__Task__c> rows_temp = new List<CloudbyzITPM__Task__c>(rows);
rows.clear();
for(CloudbyzITPM__Task__c irrTask : rows_temp)
{
if(irrTask.Name.length()>10)
{
system.debug('@@ rows of task' + rows);
irrTask.Name = irrTask.Name.substring(0,10) + '...' ;
}
rows.add(irrTask);
}
(rows.size() < 3 ){
for(integer i = 0; i <= (3 - rows.size());){
rows.add(new CloudbyzITPM__Task__c(Name = 'N/A'));
}
}
return rows;
}
public void gettaskcompleted(){
System.debug('@@lstoftaskscmp@@');
if (!Schema.sObjectType.CloudbyzITPM__Task__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.id.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.name.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Milestone__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_Start_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_End_Date__c.isAccessible()
||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_End_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_Start_date__c.isAccessible())
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
'Insufficient access'));
return;
}
System.debug('@@currentProjectId@@'+currentProjectId);
if(currentProjectId!=null)
currentProjectId=string.escapeSingleQuotes(currentProjectId);
lstoftaskscmp = [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c,CloudbyzITPM__Milestone__c,CloudbyzITPM__Planned_Start_Date__c,CloudbyzITPM__Planned_End_Date__c ,CloudbyzITPM__Actual_Start_date__c,CloudbyzITPM__Status__c FROM CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId];
}
public List<CloudbyzITPM__Task__c> getlstoftaskscmp()
{
System.debug('@@lstoftaskscmp@@'+lstoftaskscmp);
return lstoftaskscmp;
}
public pagereference redirecttoprjtskcom()
{
return new pagereference('/apex/projecttaskcomplete?id='+currentProjectId);
}
- Deepak Sharma 184
- January 30, 2017
- Like
- 0
- Continue reading or reply
triggers to share opportunity line items salesforce to salesforce
triggers to share opportunity line items salesforce to salesforce
- kalai siva 8
- January 28, 2017
- Like
- 0
- Continue reading or reply