-
ChatterFeed
-
202Best Answers
-
0Likes Received
-
0Likes Given
-
0Questions
-
1472Replies
Workflow tasks due dates weekday trigger
I am very new to Apex triggers and could use some help customizing the code to only work for opportunities of certain record types. Here is the code I am using:
trigger WeekendTasks on Task (after insert) { for (Task tas : Trigger.new) { if (Opp.RecordType == 'RPA NTE-Perm' , 'RPA NTE(No Bid)' , 'RPA RFQ' , 'RPA Capital') { Date origin = Date.newInstance(1900,1,6); Date due = tas.ActivityDate; Integer x = origin.daysBetween(due); Integer day = Math.mod(x,7); if (day < 2 ) { Task tt = new Task ( Id = tas.Id, ActivityDate = (tas.ActivityDate + 2), Description = String.valueOf(day) ); update tt; } } } }This trigger does not work as you probably already knew. If I replace the bold underlined line with:
if (tas.Subject == 'Change Stage - Awarded')Everything works perfectly, but I do not want the trigger to fire off the Subject. Could someone help me out with how to fire this trigger only for tasks associated with opportunity record types RPA RFQ, RPA NTE-Perm, RPA Capital and RPA NTE(No Bid)?
Thank you
- Joe Stolz
- August 11, 2014
- Like
- 0
- Continue reading or reply
Disable a button onClick that calls javascript function from where @RemoteAction method in apex Controller is invoked
I am trying to disable a button on meeting a condition. This <Button> helps me invoke a RemoteAction function in VF Controller. Need help in doing this. suggestion and solutions are appreciated.
Thanks
Note: This is not apex command button
- Magnetism
- August 11, 2014
- Like
- 0
- Continue reading or reply
Remove Duplicates from a List for a dropdown
List<Customer_Health__c> CSMList2 = new CSMList2();
CSMList2.addAll(CSMList);
get and error for unexpected token where bolded and underlined
Any ideas to fix?
Trying to create a dropdown of athe CSMs where there is only one of each, it is a text field.
- Christopher Pezza
- August 06, 2014
- Like
- 0
- Continue reading or reply
SOQL in loop unavoidable?
Thank you very much!
Jason
trigger CountOppTeam on OpportunityTeamMember (after insert, after delete)
{
List<Opportunity> oppList = new List<Opportunity>();
set<Id>oppIds = new set<Id>();
if(Trigger.isInsert || Trigger.isUpdate)
{
List<id> oppId = new List<id>();
for (OpportunityTeamMember oppTm: trigger.new)
{
oppIds.add(oppTm.OpportunityId);
}
for(Opportunity o: [Select id, CountTeamMembers__c From Opportunity Where id IN: oppIds])
{
List<OpportunityTeamMember> oppTmList = [Select id, Opportunityid From OpportunityTeamMember Where Opportunity.id =: o.id];
o.CountTeamMembers__c = oppTmlist.Size();
oppList.add(o);
}
update oppList;
}
else if (Trigger.isDelete)
{
List<id> oppId = new List<id>();
for (OpportunityTeamMember oppTm: trigger.old)
{
oppIds.add(oppTm.OpportunityId);
}
for(Opportunity o: [Select id, CountTeamMembers__c From Opportunity Where id IN: oppIds])
{
List<OpportunityTeamMember> oppTmList = [Select id, Opportunityid From OpportunityTeamMember Where Opportunity.id =: o.id];
o.CountTeamMembers__c = oppTmlist.Size();
oppList.add(o);
}
update oppList;
}
}
- jd_06
- August 02, 2014
- Like
- 1
- Continue reading or reply
Wrapper class with field to be updated.
I have a similar requirement as below..
https://developer.salesforce.com/page/Wrapper_Class
I also have to have a dropdown checkbox on the VF page to capture values from Picklist to insert into the new record. Everything seems to work fine in the below attached code except that when the records are inserted it inserts the same value for all the records it is inserting rather than getting the value for the inserting record from the picklist on the VF.
public OpportunityContactInsertController2 (){ optyQueryString = 'SELECT FirstName,LastName,CreatedDate,AccountId from Contact where AccountId=:acId and Id not in (select Contact_Name__c from opportunity_Contact__c where Opportunity__c=:prId)'; contList = new List<cContact>(); optySetController = new ApexPages.Standardsetcontroller(Database.getQueryLocator(optyQueryString+' limit 10')); searchRecord = new Contact(); helperRecord = new Reassign_Helper__c(); isSuccess=false; searchPerformed = false; tooManyResults= false; } public void refreshContactListBySearch(){ contList.clear(); isSuccess = false; String userFilterQuery=''; if (searchRecord.AccountId<>null) userFilterQuery += ' and AccountId= \''+searchRecord.AccountId+'\''; String optyQueryString =optyQueryString + userFilterQuery ; optyQueryString += ' order by Name limit 2'; List<Sobject> sortedResults= new List<SObject>(); try{ sortedResults = Database.query(optyQueryString); searchPerformed = true; } catch (Exception e){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); } for (SObject foundObject:sortedResults){ Contact opty = (Contact)foundObject; contList.add(new cContact(opty)); } } public void Assign(){ list<Opportunity_Contact__c> ContactInsertList=new list<Opportunity_Contact__c>(); for (cContact opty:contList) if (opty.selected) ContactInsertList.add(new Opportunity_Contact__c(Contact_Name__c=opty.oContact.id, Opportunity__c=prId,Role__c='role', Loyalty__c=loyalty,Rank__c='1' )); try { Insert ContactInsertList; } catch (Exception e) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); } integer n=contList.size(); for (integer i=n-1;i>=0;i--){ if (contList[i].selected) contList.remove(i); } if (ContactInsertList.size()>0) isSuccess = true; } public class cContact{ public Contact oContact {get;set;} public Boolean selected {get;set;} public cContact(Contact oContact){ this.oContact = oContact; selected=false; } } public list<SelectOption> getItems (){ list<SelectOption> options = new list<SelectOption>(); options.add(new SelectOption('','Select one')); options.add(new SelectOption('Entrenched Competitior','Entrenched Competitior')); options.add(new SelectOption('Switchable Competitior','Switchable Competitior')); return options; } public string getSelectedItem(){ return loyalty; } public void setSelectedItem(String loyalty){ this.loyalty = loyalty; } }
- Santhosh Parakunnath
- August 02, 2014
- Like
- 0
- Continue reading or reply
count records on lookup
Since rollup summary(count) is available only for master detail how do i get this count of child objects for a lookup relationship.
Trigger is a solution but how would that update existing records?
Is it possible to update existing records with trigger.Please help with sample code if this is possible
Please advise.
I need to get the count for a report
- Sabah Farhana
- July 31, 2014
- Like
- 0
- Continue reading or reply
InputField datepicker - want the calendar pop-up, but don't want today's date
Hi,
I have an inputfield on the page, for a Date field. I want the popup with the calendar, but don't want today's date next to the field. How do I do that? Thanks.
<apex:inputField value="{!object.my_date_field__c}"/>
screenshot: http://postimg.org/image/riaufvzfp/
- Kirill Yunussov
- December 05, 2013
- Like
- 0
- Continue reading or reply
Based on picklist selection, how to display corresponding pageblock section on VF page?
I am having a picklist field Name -(donationtype )with values Vehicle,money,shoe
Based on the value selected by the user, I want to hide another pageblock section on VF page.I am using action supportand rerender and render. but its not working
Can someone pls help me with the code.
VF PAGE:
<apex:page standardController="Pickup_Donation__c" extensions="PickupDonationcont" showheader="false" id="page" >
<table style="width: 100%;" >
<tr>
<td align="center" >
<apex:image height="128" width="1002" url="{!URLFOR($Resource.webheader)}"/>
</td>
</tr>
</table>
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Submit" action="{!save}" />
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Personal details" columns="2" >
<apex:inputfield required="true" label="First Name" value="{!Pickup_Donation__c.First_Name__c}" id="vn" />
<apex:inputfield required="true" label="Email" value="{!Pickup_Donation__c.Email__c}" id="vln2" />
<apex:inputfield required="true" label="Last Name" value="{!Pickup_Donation__c.Last_Name__c}" id="vln" />
<apex:inputfield required="true" label="Phone" value="{!Pickup_Donation__c.Phone__c}" id="vln1" />
<apex:inputfield label="Company Name" value="{!Pickup_Donation__c.Company_Name__c}" id="v1" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Communication Info" columns="2" >
<apex:inputfield required="true" label="Street" value="{!Pickup_Donation__c.Street__c}" id="v2" /><br></br>
<apex:inputfield required="true" label="State/Province" value="{!Pickup_Donation__c.State_Province__c}" id="v3" /><br></br>
<apex:inputfield required="true" label="City" value="{!Pickup_Donation__c.City__c}" id="v43" /><br></br>
<apex:inputfield required="true" label="Zip/Postal Code" value="{!Pickup_Donation__c.Zip_Postal_Code__c}" id="v4" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Donation Info" id="section1">
<apex:inputfield label="Donationtype" value="{!Pickup_Donation__c.Donation_type__c}" >
<apex:actionSupport event="onchange" reRender="section2"/>
</apex:inputField>
</apex:pageBlockSection>
<apex:outputPanel id="section2">
<apex:pageBlockSection title="Vehicles Info" rendered="{!Pickup_Donation__c.Donation_type__c == 'Vehicle'}" >
<apex:inputfield label="Vehicles Types" value="{!Pickup_Donation__c.Vehicles_Types__c}" id="textpop" />
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
<table>
<tr>
<td align="center" >
<apex:image height="128" width="1032" url="{!URLFOR($Resource.footer)}"/>
</td>
</tr>
</table>
</apex:page>
- nesh
- November 28, 2013
- Like
- 0
- Continue reading or reply
Page overriding limiting to non admin users.
Hi, I am able to override the custom page for edit and new actions of object. Thats great. But I want that admin to be able to create those records with standard page and with the custom page that I have overriden for new and edit. Is there any way to restrict this overriding to non admin users.
- SKiran
- November 27, 2013
- Like
- 0
- Continue reading or reply
Re render issue
Hi,
I am facing a rerender issue. It will be great if any one can help me out.
I have checkbox on my visualforce page, on clicking on the checkbox all the addeess info from the above fields needs to be copied over to the below fields. All the below fields are required, due to which the action function does not get called and i get the required field error on my page.
Is there any way i can handle this required field error and copy over the fields instead?
Any ideas will be of great help.
Thanks in advance!
- Aveleena
- October 12, 2013
- Like
- 0
- Continue reading or reply
VPN and salesforce
Hi,
We got this situation:
Salesforce>VPN>webservice distant.
For now I can connect to a webservice, did salesforce can connect to a webservice behind a VPN ?
Or salesforce can connect to the VPN and consume the web service ?
THanks for help !
- Sylvain@RibbonFish
- September 18, 2013
- Like
- 0
- Continue reading or reply
refresh a standard page through trigger by using a custom class but its not working
my trigger
// create a trigger on feeditem to update a account field when found '#' in post
trigger CheckChatterPostsOnAccount on FeedItem (After insert)
{
//create a account list
list<account> acclist = new list<account>();
// create a account list
list<account> acclist2 = new list<account>();
// create a set of id
set<id> s = new set<id>();
// insert a new post
for (FeedItem f: trigger.new)
{
// vrifie the condition
if (f.Body.contains('#' ))
{
String parentId = f.parentId;
// add ids in set
s.add(parentId);
}
}
// stote the check__c value from Accounts in list
acclist =[select id,test_check__c from Account where id in:s];
// Iteration of acclist
for(account acc:acclist)
{
// change the status of checkbox
acc.test_check__c =true;
acclist2.add(acc);
}
// update the status
update acclist2;
for(account acc1:acclist)
{
String st=acc1.id;
Refreshclass rc = new Refreshclass();
rc.refresh(st);
}
}
and class................................................................................
global class Refreshclass
{
public PageReference refresh(String idd)
{
System.debug(idd);
PageReference pr=new PageReference('https://ap1.salesforce.com/0019000000TSwxo');
System.debug(pr);
return pr;
}
}
- rathi007
- September 04, 2013
- Like
- 0
- Continue reading or reply
Go to Thank you page after pressing Update
Hi ,
What do I need to change to refer to a thank you page after pressing the button "Update"?
Class:
public class UpdateCampaignMemberClass{
public final CampaignMember cm;
private ApexPages.StandardController cmController;
public UpdateCampaignMemberClass(ApexPages.StandardController controller) {
cmController = controller;
this.cm= (CampaignMember)controller.getRecord();
}
public PageReference UpdateAction() {
try{
update cm;
}
catch(DmlException ex){
ApexPages.addMessages(ex);
}
return new PageReference('http://test.force.com/web2campaign/?id=' + cm.id );
} public string getStatus(string Status){
return 'Test__c';
return 'Test_2__c';
}
}
VF:
<apex:page standardController="CampaignMember" extensions="UpdateCampaignMemberClass" sidebar="false" showHeader="false"> <script type="text/javascript"> function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } } function showAlert(variable){ alert(variable); } </script> <apex:form > <b>Campaign Member ID </b><apex:inputfield value="{!campaignmember.Id}"/><br/><br/> Status <apex:inputfield value="{!campaignmember.Test__c}"/><br/><br/> Status <apex:inputfield value="{!campaignmember.Test_2__c}"/><br/><br/> <apex:commandButton value="Update" action="{!UpdateAction}" /> </apex:form> </apex:page>
- Juul
- September 03, 2013
- Like
- 0
- Continue reading or reply
Problems with apex script
Hi, I got this error message while trying to change Cases Status even though tha case doesn't have a Setup. --> : CaseResponseTimeTrigger: execution of BeforeUpdate caused by: System.QueryException: List has more than 1 row for assignment to SObject: Class.ServiceAvailability.GetHoursToUse: line 128, column 1
When I check that line 128 :
public Id GetHoursToUse(Case updatedCase, Setup__c relatedSetup) {
// Get the default business hours
BusinessHours defaultHours = [select Id from BusinessHours where IsDefault=true];
Account costCenter = [select Id, Name, Account_Top_Parent__c from Account where Id =: relatedSetup.Cost_Center__c];
System.Debug('CC Id: ' + costCenter.Id);
System.Debug('CC Name: ' + costCenter.Name);
Account mainAccount = [select Id, Name, V_Account_Number__c from Account where Id =: costCenter.Account_Top_Parent__c];
System.Debug('MA Id: ' + mainAccount.Id);
System.Debug('MA Name: ' + mainAccount.Name);
Contract contract = [select Id, AccountNumber__c, Business_Hours__c, Status from Contract where AccountNumber__c =: mainAccount.Videra_Account_Number__c];
System.Debug('Contract Id: ' + contract.Id);
System.Debug('Contract Business Hrs: ' + contract.Business_Hours__c);
System.Debug('Contract Acc Number: ' + contract.AccountNumber__c);
Id hoursToUse = contract.Business_Hours__c != null ? contract.Business_Hours__c : defaultHours.Id;
return hoursToUse;
}
I can't understand why this error occurs?
- Laaral
- September 03, 2013
- Like
- 0
- Continue reading or reply
updation failed an old values using trigger?
i have a picklist "New_Brands_c" having some values on Bottle__c object...when we select a value from this picklist Quantity field value should updated so i written trigger like this.....it works properly for new values when i created a new record but when i change this picklist value from existing record the quantity field is not updated y? means it not works with old values. i tried with trigger.old still not working...please give me solution.
trigger Populatepicklistvalue on Bottle__c (before insert) {
for(Bottle__c b:trigger.new){
if(b.New_Brands__c=='kingfisher'){
b.Quantity__c=303;
}
else
if(b.New_Brands__c=='AirLines'){
b.Quantity__c=503;
}
else
if(b.New_Brands__c=='Fishyard'){
b.Quantity__c=703;
}
else
if(b.New_Brands__c=='BombayStack'){
b.Quantity__c=903;
}
}
}
- anvesh@force.com
- August 06, 2013
- Like
- 0
- Continue reading or reply
Compile Error: Constructor not defined: [ApexPages.StandardSetController].<Constructor>...
Please refer to the following code.
I'd like to use "objList" in Visualforce Page with some paging function
( for example, setCon.getHasPrevious(), setCon.getHasNext(), and so on...).
But I don't know how to set "objLIst" into ApexPages.StandardSetController.
I know I can set "rftList". but I need to use "objList".
A part of my code is this.
public with sharing class BulkAccept { // Inner Class Definition public Class RFT_Category_for_Select { public Boolean checkAccept {get;set;} public Boolean checkNa {get;set;} public RFT_Category__c obj {get;set;} } // Property public List<RFT_Category_for_Select> objList{get;set;} // Constructor public BulkAccept() { this.objList = new List<RFT_Category_for_Select>(); List<RFT_Category__c> rftList = [ SELECT Id, Name FROM RFT_Category__c WHERE Reject__c = false ORDER BY Name ]; for (RFT_Category__c rft : rftList) { RFT_Category_for_Select objItem = new RFT_Category_for_Select(); objItem.checkAccept = false; objItem.checkNa = false; objItem.obj = rft; this.objList.add(objItem); } this.setCon = new ApexPages.StandardSetController(objList); this.setCon.setPageSize(50); }
Thanks in advance for your help.
Anna
- AnnaT
- August 06, 2013
- Like
- 0
- Continue reading or reply
Hopefully an easy one here guys....
I am trying to compare an apex variable defined as a DATE to my p.MVH_Month__c date value. (I only want to render the outputText on a control break on the data.)
<apex:variable var="LastMonth" value="{Date.parse('1990-01-01')}" />
<apex:repeat var="p" value="{!port}">
<apex:outputText rendered="{!if(LastMonth != p.MVH_Month__c,true,false)}">
.
.
.
The code won't compile it says "incorrect parameter type for operator <>. Expected TEXT received DATE.
If I change the code to this: <apex:outputText rendered="{!if(LastMonth != null,true,false)}"> it compiles so it looks like even though I am defining the <apex:variable LastMonth as a Date, the compiler is treating it like it is a String.
Thanks for any advice on this.
- moverdorf
- August 02, 2013
- Like
- 0
- Continue reading or reply
Is this Trigger Bulkified?
Hi,
Is this trigger is bulkified? I have taken this trigger from one blogg???? Here, we have not use any list or set....
trigger preventDeletion On Account(before delete){
for(Contact c :[SELECT Id, AccountId From Contact where AccountId In: Trigger.oldmap.keyset() ]){
Trigger.oldMap.get(c.AccountId).addError('Cannot delete Account with a Contact');
}
}
- Kaity
- July 23, 2013
- Like
- 0
- Continue reading or reply
Custom webservice setting remote site URL
hi,
Can someone please help.
I am new to webservice can someone help?
I have created a custom webservice in asp.net
its link is for example:
http://localhost:8732/Design_Time_Addresses/Calc/Service1/
i wana add this link to my
Security controls-->remote site settings
as I am using the wsdl generated from the page.
how do i specify the remote site url which should not give me error while making callouts for the webservice.
Thanks.
- URVASHI
- July 23, 2013
- Like
- 0
- Continue reading or reply
trigger failed on insertion of records
Here my scinario is if my Account name is not empty then it should be insert 2 records and current record but insertion is failed.
trigger mergeAccs on Account (after insert) {
list<Account> acs=new list<Account>{new Account(name='mergeAN1'),new Account(name='AnveMerge2')};
for(Account AC:trigger.new){
if(ac.name!=' '){
insert acs;
}
}
}
- anvesh@force.com
- July 23, 2013
- Like
- 0
- Continue reading or reply
Visual Force Email Help
I have a template with a table formatted as follows:
<STYLE type="text/css"> .wordwrap { word-wrap: break-word; display: inline-block; } TH {font-size: 14px; font-face: Ariel;background: #C6DBEF; border-width: 1; width: 400px; text-align: left } TD {font-size: 14px; font-face: Ariel; text-align: left; } TABLE {border: solid #CCCCCC; border-width: 1} TR {border: solid #000000; border-width: 1; vertical-align: top; text-align: left; width: 400px;} </STYLE> <font face="ariel" size="2"> <p></p> <h2>Coral Retail Priority 1 Incident Update </h2> <p></p> <table border="0" > <tr > <th>Incident Description</th><th>{!relatedTo.BMCServiceDesk__incidentDescription__c}</th> </tr> <tr > <th>Impact Analysis</th><th>{!relatedTo.Impact_Analysis__c}</th> </tr> <tr > <th>Business Incident Update Notifications</th><td><apex:outputField value="{!relatedTo.HTML_History_Notes__c }"></apex:outputField></td> </tr> </table>
But now I have been asked to format this table so that the first coloumn is a different colour (BACKGROUND: #1669BC)
So currently the email template looks like
But the first column needs to be #1669BC
I am unsure how to do this as I am not familiar with HTML and someone else designed this email template, can anyone help?
Many thanks
Sonya
- Coral Racing
- April 30, 2015
- Like
- 0
- Continue reading or reply
Trigger look up from text field both on Account page
the custom zip code feild is Equipment_Zip_Postal_Code__c
The lookup field also on the account page is TZ__c
The Custom Object API name is TZDatabase__c
with a field name of Name that need to be copied over
So far I'm getting a Invalid bind expression type of Schema.SObjectField for colimn of type String.
Any help would be GREAT
trigger TZ on Account (after update) {
String AccountId;
String TextFieldValue;
for(Account acc : Trigger.New)
{
AccountId = acc.id;
TextFieldValue = acc.Equipment_Zip_Postal_Code__c;
}
list<TZDatabase__c> TZDatabaseList = new list<TZDatabase__c>();
TZDatabaseList = [SELECT id, Name FROM TZDatabase__c WHERE Name =: account.Equipment_Zip_Postal_Code__c ];
if(TZDatabaseList.size() > 0)
{
for(TZDatabase__c acc : TZDatabaseList)
{
account.TZ__c = Account.Equipment_Zip_Postal_Code__c;
}
try{
update TZDatabaseList;
}
catch(Exception ex)
{
//add error message
}
}
}
- Lance Brown
- August 23, 2014
- Like
- 0
- Continue reading or reply
Display list of Accounts
Can anyone tell me how to display list of all account_name in two column in VFP??
Thanks in advance
Karthick
- SS Karthick
- August 23, 2014
- Like
- 0
- Continue reading or reply
- Venkata Sravan Kumar Bandari
- August 23, 2014
- Like
- 0
- Continue reading or reply
Web Service callout error
I'm making a web service call to the metadata API from an Apex controller, and I'm getting the following error:
Got an unexpected error in callout : null. Contact support with error ID: 1650857327-111252 (-1513776465)
Can someone please shed some light on the actual cause of the error?
Thanks.
- Robert Dietrick
- August 22, 2014
- Like
- 0
- Continue reading or reply
Accounts and its associated Contacts on VF page
I need to display like below.
-------------------------------------
Account Name1
Contact1
Contact2
Account Name2
Contact1
AccountName3
Contact1
-------------------------- etc
Like this per each Account Name i need to display associated contacts below that account as shown above.
Please send sample code to achieve this.
- Lavanya Ponniah 3
- August 16, 2014
- Like
- 0
- Continue reading or reply
i am writting a simple query but its giving an error
i dont understand where i am going wrong can any one guide me
- SFDC Bayya
- August 16, 2014
- Like
- 0
- Continue reading or reply
how to insert owner field in new record in salesforce
I am trying to creating new record sorce is coming out of the BOX using rest what i am creating new record that record owner also come out ofthe box that is also salesforce org.
hear my problem is insert owner field in new record.
- kamal_Rao
- August 16, 2014
- Like
- 0
- Continue reading or reply
What does "return false" do exactly ?
<apex:page standardController="Case">
<A HREF="#" onClick="testCloseTab();return false">
Click here to close this primary tab</A>
<apex:includeScript value="/support/console/20.0/integration.js"/>
<script type="text/javascript">
function testCloseTab() {
//First find the ID of the current primary tab to close it
sforce.console.getEnclosingPrimaryTabId(closeSubtab);
}
var closeSubtab = function closeSubtab(result) {
//Now that we have the primary tab ID, we can close it
var tabId = result.id;
sforce.console.closeTab(tabId);
};
</script>
</apex:page>
Simple question: What does "return false" do ?
I've been working on an issue to open a subtab inside a primary tab by
clicking a apex commandButton. I have an onclick="openSubtabFunction()" on
the button to trigger a function when clicked.
The issue was after the first click of the button, my subtab would not open.
Here is my action sequence:
- I click the commandbutton and the onclick function is triggered to open the subtab (tab opens fine)
- I close the subtab.
- I repeat step 1. Subtab doesn't open
All I did to fix the issue was change my onclick code to:
onclick="openSubtabFunction();return false"
And then, I can open the subtab repeatedly.
But, I just want to know what kind of difference "return false"
makes.
If anyone can explain, it would be appreciated very much.
Thanks, Chris
- Chris Voge
- August 16, 2014
- Like
- 0
- Continue reading or reply
google map not showing up on Visualforce page
<apex:page controller="SampleLocation">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY">
</script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"/>
</body>
</apex:page>
when I preview the page, nothing is shown.
when I save the exact same code in separate html file ( after removing apex:page tag) the code works just fine. I am sure that there is no issue with the API key.
any idea what is going wrong here ?
- APN09217013342392059
- August 16, 2014
- Like
- 0
- Continue reading or reply
How to make the Name field not shown up in the page
- Jacob W Landis
- August 13, 2014
- Like
- 0
- Continue reading or reply
Barcode Generator.
I ahve a requirement Bar code Genarator. Using with VF Page.please help me any one.
- Sai A
- August 13, 2014
- Like
- 0
- Continue reading or reply
Creating an Exploded Record View
- Matt Folger
- August 13, 2014
- Like
- 0
- Continue reading or reply
Multiple Object Query with SOQL
Basically I'd like to combine the following (examples):
SELECT Name, Email, Phone FROM Contact WHERE Phone != null AND PhoneSearch1__c LIKE '%0149%' order by Name asc limit 75
SELECT Name, Email__c, Phone FROM Account WHERE Phone != null and PhoneSearch1__c LIKE '%0149%' order by Name asc limit 75
This might could be done by assigning the queries as variables? I'm not sure. Any help would be greatly appreciated! Thanks!
- Patrick Conner
- August 13, 2014
- Like
- 0
- Continue reading or reply
Immediate="true" is not stopping required field validation on VF Page
<apex:page standardcontroller="Case" extensions="TestPassJSVariable"> <script type="text/javascript"> function createCase(cancel) { var supplier = document.getElementById('{!$Component.form.block.section1.supplierInput}').value; if(cancel == 1) { cancelFunction(); } else { createFunction(supplier); } </script> <apex:form id="form"> <apex:actionFunction name="createFunction" action="{!createCase}" rerender="view"> <apex:param id="supplier" assignTo="{!supplier}" name="supplier" value="" /> </apex:actionFunction> <apex:actionFunction name="cancelFunction" action="{!cancelCreate}"/> <apex:inputField id="supplierInput" value="{!Case.Supplier__c}" required="true"/> <apex:commandButton value="Create" onclick="createCase();" rerender="view"/><apex:commandButton value="Cancel" onclick="createCase(1);" immediate="true"/></center> </apex:form> </apex:page>I am trying to make the "supplierInput" field required, but also allow a cancel button on the page to go back to the previous URL without having to enter that information in. I thought the immediate="true" attribute was supposed to allow this to happen, but it isn't working.
What am I missing here?
- adrissel
- August 13, 2014
- Like
- 0
- Continue reading or reply
APEX Code Help: Multiple entries in Case Comment when clicking Edit and Save.
I currently implemented a code (which I copied somewhere) in my Production which copies the email body and insert it to Case Comment. However, I am getting multiple entries when I edit and Save the record.
Ex. When the email comes in, it copy the email body and the code insert it to case comment. When I click the Edit button and Save WITHOUT changing any information, it creates a duplicate on the case comment.
How can I correct this behavior that it should only create case comment when a new email is sent or received?
trigger commentMove on Case (after update) { Case myCase = trigger.new[0]; if (myCase.New_Case_Comment__c!= null) { String caseId= myCase.ID; CaseComment cc = new CaseComment(CommentBody=myCase.New_Case_Comment__c,parentID=caseId); insert cc; } }
Any assistance is greatly appreciated.
- SF_Admin96
- August 11, 2014
- Like
- 0
- Continue reading or reply
Workflow tasks due dates weekday trigger
I am very new to Apex triggers and could use some help customizing the code to only work for opportunities of certain record types. Here is the code I am using:
trigger WeekendTasks on Task (after insert) { for (Task tas : Trigger.new) { if (Opp.RecordType == 'RPA NTE-Perm' , 'RPA NTE(No Bid)' , 'RPA RFQ' , 'RPA Capital') { Date origin = Date.newInstance(1900,1,6); Date due = tas.ActivityDate; Integer x = origin.daysBetween(due); Integer day = Math.mod(x,7); if (day < 2 ) { Task tt = new Task ( Id = tas.Id, ActivityDate = (tas.ActivityDate + 2), Description = String.valueOf(day) ); update tt; } } } }This trigger does not work as you probably already knew. If I replace the bold underlined line with:
if (tas.Subject == 'Change Stage - Awarded')Everything works perfectly, but I do not want the trigger to fire off the Subject. Could someone help me out with how to fire this trigger only for tasks associated with opportunity record types RPA RFQ, RPA NTE-Perm, RPA Capital and RPA NTE(No Bid)?
Thank you
- Joe Stolz
- August 11, 2014
- Like
- 0
- Continue reading or reply
Why Apex batch job is failed
There were 51 batch failures because of "First error: Ending position out of bounds: 5"." issue but the process stopped with status failed after processing 5K batches.
What could be the possible reason behind this failure ? Any help would be greatly appreciated.
Thanks
- Jai Kumar Gupta
- August 11, 2014
- Like
- 0
- Continue reading or reply
Disable a button onClick that calls javascript function from where @RemoteAction method in apex Controller is invoked
I am trying to disable a button on meeting a condition. This <Button> helps me invoke a RemoteAction function in VF Controller. Need help in doing this. suggestion and solutions are appreciated.
Thanks
Note: This is not apex command button
- Magnetism
- August 11, 2014
- Like
- 0
- Continue reading or reply