-
ChatterFeed
-
56Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
306Replies
SOQL Statement
I really need some help here, I have a SOQL statement the grads a specific list of records and child records, but I need to edit the statement to only include those child records that are currently active, I have a check mark box called "Active" on the child record.
Here is my statment:
<soql>select LDC_Account_Number__c, meter_number__c from meter__c where ldc_account__c in (select id from ldc_account__c where opportunity__c='{!ServiceContract.opportunity__r.id}') order by ldc_account_number__c</soql>
meter__c is the child record
name of the field is Active__c
This is only my 5th SOQL statement, still learning, any assistance would be greatly appreciated.
Thank-you
- Shane Quiring
- June 01, 2015
- Like
- 0
- Continue reading or reply
Trying to do something simple with an Onclick Javascript button! Can't get it to work!!
Hi there,
I'm not a developer, but am trying to accomplish something with an Onclick Javascript Button in Salesforce.com for educational purposes. I feel like I'm getting close, but I'm still failing.
The objective here is the following:
Upon clicking this Onclick Javascript Button on the opportunity record, the following actions will occur:
1. Update a checkbox on the opportunity
2. Create a related quote with the quote name field populated to "PQ"
3. Return to the opportunity record when complete
I have the following code, which is only accomplishing 1 and 3:
{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")}
var update_Opp = []; /*Declaring an array to pass the parameters */
var oOpp= new sforce.SObject("Opportunity"); /* Declaring an object for the Case */
oOpp.Id='{!Opportunity.Id}'; /*setting the ID of the object to the Id of the current opp*/
oOpp. Quote_Requested__c = true; /* Setting the checkbox value as true */
update_Opp.push(oOpp); /*pushing the updated object in queue*/
result_Update=sforce.connection.update(update_Opp); /*updating the object*/
window.location.reload(); /* asking the page to refresh */
var newquote= new sforce.SObject("Quote");
newquote.Name = "PQ";
newquote.OpportunityID="{!Opportunity.Id}";
result = sforce.connection.create([newquote]);
alert(result );
window.location.reload();
Can anyone help with where I am screwing this up?
Also, how would I go about making these actions dependent on a condition? Say, if field x on the opportunity was null, prevent the actions from taking place.
Thank you for any help!!!!
- John Braun
- May 14, 2013
- Like
- 0
- Continue reading or reply
How to wrap apex:columns in a div to use in slideToggle()
Hi All,
I am trying to have a jquery slideToggle() function bound to a row of data in an apex:pageBlockTable.
I am displaying some information in the table and want that if someone clicks on any row, some more information related to that contact is displayed in a slider and the rest of the rows move down. When he clicks again, the slider moves up and everything is back to normal.
If I am not wrong, I think I need to bind row elements (apex:columns) in one div and the information in the slider in the other. But somehow this is not working.
Here is the code:
<apex:page controller="xingShowSearchResult"> <head> <style type="text/css"> #rowInfo,#rows { padding:5px; text-align:center; background-color:#e5eecc; border:solid 1px #c3c3c3; } #rowInfo { width:50px; display:none; } </style> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script> <script> $j = jQuery.noConflict(); $j(document).ready(function(){ $j("#rows").click(function(){ $j("#rowInfo").slideToggle("slow"); }); }); </script> </head> <body> <apex:pageMessages /> <div id='backtoDiv' style="height:20px;"> <apex:outputLink value="/apex/XingPageTab" style="color:blue;">Back to Home Page</apex:outputLink> </div> <apex:pageBlock title="Suche Kontakte"> <apex:pageBlockSection columns="1"> <apex:form style="float:right" > <apex:commandLink style="height:20px;font-weight: bold;" value="Suchergebnisse entfernen" action="{!deleteSearchResult}" /> </apex:form> </apex:pageBlockSection> <apex:pageBlockTable value="{!newList}" var="contacts" id="contactsTable"> <div id="rows"> <apex:column > <apex:image url="{!contacts.photoURL__c}" /> </apex:column> <apex:column headerValue="Name"> {!contacts.displayName__c}</apex:column> <apex:column headerValue="Firma"> {!contacts.firma__c}</apex:column> <apex:column headerValue="Title" > {!contacts.title__c}</apex:column> </div> <div id="rowInfo" > <p> This is the paragraph to end all paragraphs. You should feel <em>lucky</em> to have seen such a paragraph in your life. Congratulations! </p> </div> </apex:pageBlockTable> </apex:pageBlock> </body> </apex:page>
I am trying to understand VF and JS so any help would be appreciated.
Best,
Ankit
- Taneja
- May 14, 2013
- Like
- 0
- Continue reading or reply
Auto populate a form's lookup field based on parent field
Hello!
I am very new to Visual Force, roughly 4 weeks.
I currently am in the process creating of creating a two page wizard. Pretty standard, multiple steps powered by one controller.
Page One of the wizard allows the user to create an item. (Master-Detail Parent)
Page Two of the wizard allows the user to take that same item and add as many sub-items as they wish. (Child)
Here is my only snag. Due to their relation, SUB-ITEM has a lookup field that is based off the ITEM name.
Upon creating the item and landing on page 2, I do not want the user to manually choose the item name in the subitem lookup field again to associate it with the parent.
What are my options?
1) So far I only attempted a preliminary insert statememt of subitem.item__c = item.name__c which gave me the good old string id error. I assume this is because a lookup does not work simply by pulling the string as im sure it related to the ID on the backend.
2) I figured another way to do it would be writing java script to grab the apex:inputhidden item.name text and paste it into the lookup field.
3) Or possibly use a trigger?
I have stewed on this for awhile but I figured I would mention this on the forums as I do not want a band-aid or a quick fix. I want to learn how to do it the write way as this will be a recurring problem as i continue my development.
In advance, I greatly appreciate your assistance!
- EJN5007
- May 04, 2013
- Like
- 0
- Continue reading or reply
How to get the Id of the last inserted record to make a lookup relationship with another record?
Hi all,
I have recently faced a problem while creating an apex class for inserting two records from a visulaforce page. I want to insert the contact info in contact object and then want to get the Id of that contact record to assign it to ContactId in the Campaignmember object. But got error that the Id is null. Here is my code goes
Creating contact object:
----------------------------------------
Contact cont= new conatct();
cont.LastName=lastname;
...
...
insert cont;
That works fine and the contact is being inserted
--------------------------------------------
Now when I want to get the Id of the above record it given me an error
CampaignMember CaMem = new CampaignMember();
CaMem.ContactId =cont.Id;
insert CaMem; // Error: the conatctId is null.
It means that the cont.Id is null. One way is to query the contact records and order them by a fields like creadteddate etc and get the last or first record and suppose that it is the one inserted just recently. I am not going with this solution.
Does anyone know how to solve this issue? Is there some system method that keep the id with its insertion inline to use it down in the code?
Any usefull suggestions please. Thanks for your support and help
- davidwat
- November 10, 2011
- Like
- 0
- Continue reading or reply
Javascript to update a values in a td within a outputpanel or Center text in panel
Hey folks, I'm having some real difficulty here.
Here's what I'm trying to do. My goal is to have very quick client-side "warnings and errors" messages display on a VF page. Going to controller and back everytime users are entering data simply takes way too long.
I'm already using Javascript on that page to handle some client-side calculation. So I'm planning on also using Javascript to Identify when a data error has occured and then display text within a output panel. I want this text red, bold and centered on the page.
I've been able to get the text to display in an output panel, be bold and red - but I can never get it to be centered.
Here's a slimmed down version of what I got.
<apex:page standardcontroller="Contract_Product__c" extensions="Contract_Product_Add_Extension_jquery" id="page"> <apex:form rendered="{!Master.AccountID != null && Master.Lock_Status__c != 'Locked' || $Profile.Name == 'System Administrator'}" id="ProductForm"> <apex:outputpanel id="SelectContractProducts" layout="none"> <apex:pageblock id="ContractProductsBlock" title="Select Contract Products" rendered="{!Display}"> <apex:outputpanel id="Warnings" > <table width="100%" id="WarningsTable"> <tr id="WarningsRow"> <td id="WarningsCells"> </td> </tr> </table> </apex:outputpanel> </apex:pageblock> </apex:ouputpanel> </apex:form> </apex:page>
If I remove the WarningsTable (and all chidlren) I can update the OutputPanel "Warnings" succesfully with
document.getElementById('{!$Component.page.ProductForm.ContractProductsBlock.Warnings}').innerHTML
However trying to update the table I've been unsuccessful in getting the Table, Row, or Cell IDs. The only reason I'm using a table is to get the text to be centered.
Anyone provide some guidance? I either need to get the text centered in the output panel so it's centered within the pageblock or I need to get to the TD value so I can add and delete warnings.
- BrianWK
- November 03, 2011
- Like
- 0
- Continue reading or reply
IF AND Syntax for tests before executing code
Newbie here... I've gotten this far but need some help tweaking the syntax - could anyone offer some advice?
I'm not sure how to format the IF with an AND condition?
public PageReference completeOrder() { Set<String> RErequiredFiles = new Set<String>{'Valuation'}; Set<String> BOVrequiredFiles = new Set<String>{'Valuation', 'Invoice'}; List<File__c> existingFiles = new List<File__c>(); Set<String> uniqueTypes = new Set<String>(); Service_Request__c ord = [select Status__c, Type__c from Service_Request__c where Id = :orderId]; existingFiles = [select Type__c from File__c where Service_Request__c = :orderId]; for(File__c f: existingFiles) { uniqueTypes.add(f.Type__c); } Boolean resultRE = uniqueTypes.containsAll(RErequiredFiles); Boolean resultBOV = uniqueTypes.containsAll(BOVrequiredFiles); PageReference completed = ApexPages.currentPage(); if(ord.Type__c == 'Unified') AND(resultRE == false) { ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Missing required documents'); ApexPages.addMessage(myMsg); } else if(ord.Type__c != 'Unified') AND(resultBOV == false) { ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Missing required documents'); ApexPages.addMessage(myMsg); } else if (ord.Status__c != 'Appraisal Contracted') { ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Order has already been completed, for additional files please utilize the Upload File button'); ApexPages.addMessage(myMsg); } else { ord.Status__c = 'Valuation Received'; update ord; completed = new PageReference('/success'); } return completed; }
- tsalb
- July 11, 2011
- Like
- 0
- Continue reading or reply
Can we return all ticked values?
Hope someone can help. Am writing a formula field in one object (B) where I want only the values associated with checkboxes on another object (A) to appear. There may be one, two or even three checkboxes ticked in object A, so I would want some way of all the values which are ticked appearing in object B, but not the other values which are not ticked.
It seems that if I do an IF formula, I can only get the first ticked value in the field to appear, but not the other ticked values. I tried using a "," separator so that a list of values would appear separated by a comma, but I couldn't get the syntax to work. I would prefer to have each field labelled (Objective 1, Objective 2 etc), and was trying to think of a way for the field label itself not showing if the value was null, but I can't see a way to do that. This is my formula:
IF(Homework__r.Objective_1__c = TRUE, Homework__r.Objectives_1__c, IF(Homework__r.Objective_2__c = TRUE, Homework__r.Objectives_2__c, IF(Homework__r.Objective_3__c = TRUE, Homework__r.Objectives_3__c, IF(Homework__r.Objective_4__c = TRUE, Homework__r.Objectives_4__c, IF(Homework__r.Objective_5__c = TRUE, Homework__r.Objectives_5__c, IF(Homework__r.Objective_6__c = TRUE, Homework__r.Objectives_6__c, null))))))
Any help on this would really be appreciated. Thanks!
- kkantha
- July 08, 2011
- Like
- 0
- Continue reading or reply
Help with Apex code in trigger
Hey guys some background into my prob. I need a lookup field, Account__c, to auto-populate with an account name on update of an event payment object.
The relavent schema looks like this:
Account
Id
Opportunity
AccountId
opportunity child Event Payment
Account__c
So heres what I got so far:
trigger accountRename on Event_Payment__c (after update) {
Set<Id> accIDs = new Set<Id>();
for(Event_Payment__c a: Trigger.new){ accIDs.add(a.Id); }
List<Account> accountList = [SELECT Id FROM Account WHERE Id in :accIDs];
for(Event_Payment__c a : Trigger.new){
for(Account i : accountList){ a.Account__c = i.Id;
} update accountList; } }
Any ideas?
- Hi There!
- January 20, 2011
- Like
- 0
- Continue reading or reply
Data Validation help please
Hey Guys,
I'm trying to create a quick data validation rule and seem to be having some trouble. I'm trying to make it so if one date field is used on a lead then 2 other text fields are required to save the contract. I have this so far, but keep getting errors:
and( Appointment__c ,len(Appointment_Time__c, Appointment_City__c)=0 )
Thanks for the help in advance!
- Grifmang
- January 03, 2011
- Like
- 0
- Continue reading or reply
Help Please - - Include item In Web to Lead Form
Hello,
I'd like to use a web to lead form on a specific product page. In addition to the normal inquiry information (name, address, etc), I'd like to dynamically include the product name from the web page. Is there a simple way of doing this and sending it to Salesforce?
Thanks.
- JohnWorth
- October 29, 2010
- Like
- 0
- Continue reading or reply
Take Text Input, Output Date
Ok, very simply I'm having trouble with a part of my visualforce page and controller where I try to take a user's input (Text format date in the form of DD/MM/YYYY) and then output it as a date.
I understand that BegDate is initialized to 'Null' when the page is loaded because the controller is compiled before the page, what I don't know is how to fix that.
I'm getting the error:
System.TypeException: Invalid integer: BegDate Class.TestViewController.stringToDate: line 19, column 20 Class.TestViewController.getDayDate: line 7, column 16 External entry point
My VF Page Code is:
<apex:page showHeader="false" standardStyleSheets="false" controller="TestViewController"> <apex:form > <apex:inputText value="{!BegDate}"/> <apex:outputText value="{!DayDate}"/> </apex:form> </apex:page>
My Controller Code is:
public class TestViewController { public String BegDate { get; set; } // Turns the User's string input into a date Public Date getDayDate(){ return stringToDate('BegDate'); } //Converts a string from mm/dd/yyyy to a date public Date stringToDate(String s){ //Input Date String is in the format mm/dd/yyyy if(s.length()== 0) { return NULL; } else{ String[] stringDate = s.split('/'); Integer m = Integer.valueOf(stringDate[0]); Integer d = Integer.valueOf(stringDate[1]); Integer y = Integer.valueOf(stringDate[2]); return date.newInstance(y,m,d); } } }
- SFmaverick
- September 01, 2010
- Like
- 0
- Continue reading or reply
Owner Control
Hello everyone!
Do you know if is there any way to make a counter to know how many times has a Lead changed his owner?
Thanks in advance!
- javierjies
- April 05, 2010
- Like
- 0
- Continue reading or reply
Custom object to hold settings - Prevent hardcoding in Apex code
I have a custom object called 'Sample Request' which has look up relationship to lead object and contact object. There are many record types for Contact and also for Lead as my company has business in different regions. Due to the same reason there are different page layouts and record types for 'Sample Request' object also.
To make it simple for Ex: say there are
2 rec types and page layouts for Contact - C1 and C2 and there are
2 rec types and page layouts for Lead - L1 and L2 and there are
4 rec types and page layouts for Sample Request - R1, R2, R3, R4
I have created a custom button (VF page and controller) called 'Create sample Request' in Lead and Contact page that takes user to the appropriate 'Sample Request' page depending on the originating record type of contact or Lead.
The apex controller code checks various record types as below
if the record type is C1 forward the user to page with Rec type as R1
if the record type is C2 forward the user to page with Rec type as R2
if the record type is L1 forward the user to page with Rec type as R3
if the record type is L2 forward the user to page with Rec type as R4
When there is a new rec type added for a different business unit, changes are needed in the code to handle the new Rec Type. This needs code deployment to production apart from config changes.
I am looking into creating a custom object that will hold setting like this that can be used by the Apex controller to forward user to the correct page layout. In this case it is a simple mapping of Rec type to Rec type in the custom object. This will make the code generic enough, prevent the hardcoding of record types in the code and reduce maintenance with future config changes. When there is a new record type, a new record need to be added in the custom object and we are good to go.
I looked into using custom settings, but I am not able to figure out if that can be used for something like this. I am sure this hardcoding in code is something that everyone runs into at one point or other. I would like to know how others are handling scenarios like this. Any suggestions/comments would be very helpful.
Thanks!
- DCS
- April 01, 2010
- Like
- 0
- Continue reading or reply
Can't get <apex:pagemessages /> to render a message.
I'm struggling with being able to show a basic success message to the user using the standard <apex:pagemessages /> component. I've got it on the page, but it never shows a message. Here's the page:
<apex:pageblock > <apex:pageblockSection > <h1>Page Messages:</h1> <apex:pageMessages /> </apex:pageblockSection>
Nothing unusual there, right?
Here's the controller method that generates the message. Basically I've got a list with checkboxes, and the user selects some, clicks a button, and then records are inserted based on the selections. When that happens, I'd like to let the user know the insert was successful.
if (billTos.size() > 0) { try{ insert billTos; // set the message for the user ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Bill-To Sites successfully created')); } catch (DMLException e){ // show the messages to the user ApexPages.addMessages(e); } } else { // set the message for the user ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'No Sites Selected')); }
My records are being successfully inserted, so it should be hitting the success message. But it's all silent on the page -- nary a peep. What the heck am I doing wrong? This seems simple!!
- Jay_Hunter
- March 29, 2010
- Like
- 0
- Continue reading or reply
Javascript function on VF page not working
Hey guys,
Can anyone tell me why these don't update the status__c field of the record I specify when clicking an outputLink?
<script src="../../soap/ajax/18.0/connection.js" type="text/javascript"> <!-- Testing some simple field updates in jScript rather than using controllers --> function departShp(){ var shp = new sforce.SObject("Shipment__c"); shp.id = "{!Shipment__c.id}"; shp.Status__c = "In transit"; result = sforce.connection.update([shp]); if (result[0].getBoolean("success")) { log("Shipment with id " + shp.id + " updated"); } else { log("failed to update shipment" + shp.id]); } } function updateShp() { try { var shp= new sforce.SObject("Shipment__c"); shp.Id = "{!Shipment__c.Id}"; shp.Status__c = "In transit"; var result = sforce.connection.update([shp]); if (result[0].getBoolean("success") == false ) { alert(result[0].errors.message); return; } window.top.location.href=window.top.location.href; } catch (e) { alert(e); } updateShp(); } </script>
The button
<apex:form > <apex:outputLink value="/{!Shipment__c.id}" onclick="updateShp()" rendered="{!$Profile.Name = 'System Administrator'}"> Shipit </apex:outputLink> </apex:form>
Both of these are pulled from examples I found: one in ajax dev guide, and one in custom button that marks a task as complete provided by Salesforce.com labs for free...
Can't quite figure out how to make it work for me.
I'd like to avoid using APEX because it goes towards my total apex limit, and I have to build test classes, so it's not very efficient.
Thanks!
JNH
- JNic
- March 25, 2010
- Like
- 0
- Continue reading or reply
Validation noob question
Hi. Today I was asked to create a lead form that would connect to the lead object. The form itself was easy to set up, and it works fine. However, now I want to add validation to the form.
I have created a basic validation rule for the first name that looked like this:
ISBLANK( FirstName), specified the error position to be Field, activated the validation rule.
At this point I expected for it to kick in if I were to submit a form with empty last name. However, I got redirected to the success page, but the empty lead didn't get registered in the system. Does it mean the validation worked? Or was it some kind of default validation? Are there any mistakes in my workflow?
Any ideas would be very welcome.
Thanks!
Luka
- Lookitsch
- March 25, 2010
- Like
- 0
- Continue reading or reply
Remove checkboxes from related list
Hi,
I want to remove checkboxes from Products Related List on Opportunity Details page. How can I do this.
Thank you.
- miha198206
- March 23, 2010
- Like
- 0
- Continue reading or reply
rest of a math division
Hello everyone!!
Doy you know how could I get the Rest of a Math Division with APEX? it is not with the % symbol??
Thanks in advance!!!
- javierjies
- March 23, 2010
- Like
- 0
- Continue reading or reply
missing ; before statement
I have written some code to update a check box from a custom button. However, I continue to get an error that says" "missing ; before statement"
Here is my code;
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
var theId ="{!Contact.Id}";
var c = new sforce.SObject("{!Contact.Id}");
var objectsArray = [];
c.Id = {!Contact.Id};
Contact.Andon_Cord_Flagged__c = 1;
//Push the Update
var callCompleted = false;
objectsArray .push(c);
try{
var result = sforce.connection.update(objectsArray );
callCompleted=true;
}
catch(error){
alert ("En error occured : " + error);
}
if (callCompleted){
for (var i=0;i<result.length;i++){
if (!result[i].getBoolean("success")){
alert ("Error encountered while updating record id " + theId + " : " + result[i].error);
}
}
//Reload Window
window.location.reload(true); }
ANY IDEAS?
- Josephto
- March 18, 2010
- Like
- 0
- Continue reading or reply
Spring '10 - Changing Opportunity Stage does not update probability?
A number of our users are reporting that changing the Opportunity Stage does not update the Probability %.
The culprit seems to be the salesforce javascript that is called when a change is made to the stage:
Error: pl.oppo.pct is null or not an object
Has anyone else encountered this issue?
- CaptainObvious
- March 09, 2010
- Like
- 0
- Continue reading or reply
Trigger to roll up values
I've written a trigger to roll up values from a custom object to associated contracts. It works great- as long as the contract has under 200 Sales:
trigger rollupValues on PN_Sales__c (after insert, after update, after delete) { Map<Id,Contract> ContractsToUpdate = new Map<Id,Contract>(); Set<Id> ContractIDs = new Set<Id>(); if(Trigger.isInsert || Trigger.isUpdate){ for(PN_Sales__c pnSale : trigger.new){ //check that the Contract is specified if(pnSale.Contract__c != null){ if(!ContractIDs.contains(pnSale.Contract__c)){ ContractIDs.add(pnSale.Contract__c); } } } } if(Trigger.isDelete || Trigger.isUpdate){ for(PN_Sales__c pnSale : trigger.old){ //check that the Contract is specified if(pnSale.Contract__c != null){ if(!ContractIDs.contains(pnSale.Contract__c)){ ContractIDs.add(pnSale.Contract__c); } } } } //Fetch the Contract and Associated Sales Data: if(ContractIDs.size() > 0){ for (Contract conTracts : [SELECT Id, Current_Value__c, Forecasted_Value__c, Current_Volume__c, (SELECT Id, Product__c, Quantity__c, Revenue_USD__c, Gross_Revenue_USD__c, Valid__c, PN_Account__r.PN_Type__c, Contract_Volume__c, Contract_Revenue__c, Status__c FROM PN_Sales__r) FROM Contract WHERE Id in :ContractIDs]){ ContractsToUpdate.put(conTracts.id,conTracts); } //For every Contract... for(Contract conTract: ContractsToUpdate.values()){ //Initialize all sums to '0': Double currentVolume = 0; Double currentValue = 0; Double forecastedValue = 0; Double totalvolume = 0; //...Loop through all associated sales: for (PN_Sales__c pnSale: conTract.PN_Sales__r){ if (pnSale.Quantity__c == null) { pnSale.Quantity__c = 0; } String accountType = pnSale.PN_Account__r.PN_Type__c; String saleStatus = pnSale.Status__c; if (pnSale.Revenue_USD__c == null) { pnSale.Revenue_USD__c = 0; } if (pnSale.Gross_Revenue_USD__c == null) { pnSale.Gross_Revenue_USD__c = 0; } //Now perform the calculations (depends on account type): if ( accountType == 'BV' || accountType== 'CMD' ) { //Calculate Current Value if (saleStatus == 'Actual' || saleStatus == 'Estimate') { if (pnSale.Contract_Revenue__c == 'Include' && pnSale.valid__c==true) { currentValue += pnSale.Gross_Revenue_USD__c; } } //Calculate Forecasted Value if (pnSale.Contract_Revenue__c == 'Include' && pnSale.valid__c==true) { forecastedValue += pnSale.Gross_Revenue_USD__c; } } else { //Calculate Current Value if (saleStatus == 'Actual' || saleStatus == 'Estimate') { if (pnSale.Contract_Revenue__c == 'Include' && pnSale.valid__c==true) { currentValue += pnSale.Revenue_USD__c; } } //Calculate Forecasted Value if (pnSale.Contract_Revenue__c == 'Include' && pnSale.valid__c==true) { forecastedValue += pnSale.Revenue_USD__c; } } //Calculate Volume if (saleStatus == 'Actual' || saleStatus == 'Estimate') { if (pnSale.Contract_Volume__c == 'Include' && pnSale.valid__c==true) { currentVolume += pnSale.Quantity__c; } } } conTract.Current_Value__c = currentValue; conTract.Forecasted_Value__c = forecastedValue; conTract.Current_Volume__c = currentVolume; } //Finally update Contracts with rollup values: update ContractsToUpdate.values(); } }
I've taken out debug messages from the code above for the sake of clarity, but the debug log clearly shows the sales looping up to the 199th record and then stopping with the message: System.Exception: invalid query locator.
I was wondering if this is a limitation or if there is another approach I should take? I've tried using a SOQL for loop as suggested in the Apex Developer guide, but I couldnt get the values to sum across all sales.
- CaptainObvious
- August 07, 2009
- Like
- 0
- Continue reading or reply
Username/Password required AFTER logging in to the boards?
Im not sure if anyone else is experiencing this issue: When logged in to the boards, I get popups requiring a password: The server com-salesforce-wiki-1s.wwwa.com at SalesForce requires a username and password. This happens any time I click on a new thread/ section.
When logged out, the popups do not appear. :smileyvery-happy:
- CaptainObvious
- June 08, 2009
- Like
- 0
- Continue reading or reply
Help with testMethod: Pre-populating fields on new Record
Some Background:
We have a custom object called GRE DI Code.
We create new GRE DI Codes from the Lead page through a custom link. Information on the GRE DI Code edit page is pre-populated with fields from the Lead and Account objects.
Previously, we accomplished this through an s-control.
We are attempting to migrate the functionality to Visualforce...
Visualforce Page:
<apex:page standardController="GRE_DI_Code__c" extensions="diCodeCreateExt" showHeader="true" sidebar="true" > <script type="text/javascript"> function populate() { //pre-populate vf page based on values from Lead & Account page: document.getElementById("{!$Component.myForm.pgB.pgBSec.gredcName}").value = 'GRE-' + '{!Lead.Di_Code__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.webSite}").value = '{!Lead.Website}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.fiName}").value = '{!Account.Name}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.greDC}").value = '{!Lead.Di_Code__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.app}").value = '{!Lead.Name}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.addr}").value = '{!Lead.Institution_Address__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.acc}").value = '{!Account.Name}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.city}").value = '{!Lead.Institution_City__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.dept}").value = '{!Lead.Department__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.state}").value = '{!Lead.Institution_State_Province__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.zip}").value = '{!Lead.Institution_Zip__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.phone}").value = '{!Lead.Institution_Phone__c}'; document.getElementById("{!$Component.myForm.pgB.pgBSec.email}").value = '{!Lead.Email}'; //pre-populate picklist var lvl_select = document.getElementById("{!$Component.myForm.pgB.pgBSec.lvl}"); var pVal1 = '{!Lead.Institution_Type__c}'; for( i=0; i < lvl_select.length; i++ ) { if( lvl_select.options[i].value == pVal1) { lvl_select.selectedIndex = i; break; } } //Another picklist... set the default to 'Active-To Be Published' var stat_select = document.getElementById("{!$Component.myForm.pgB.pgBSec.status}"); for( i=0; i < stat_select.length; i++ ) { if( stat_select.options[i].value == 'Active-To Be Published') { stat_select.selectedIndex = i; break; } } } window.onload=populate; </script> <style> .aField { width: 200px; } </style> <apex:sectionHeader title="GRE DI Code Edit" subtitle="New GRE DI Code" /> <apex:form id="myForm"> <apex:pageBlock title="GRE DI Code Edit" mode="edit" id="pgB"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Information" columns="2" id="pgBSec"> <apex:inputField id="gredcName" value="{!GRE_DI_Code__c.Name}" required="true"/> <apex:inputField id="webSite" value="{!GRE_DI_Code__c.Website__c}"/> <apex:InputField id="fiName" value="{!GRE_DI_Code__c.Full_Institution_Name__c}"/> <apex:inputField id="greDC" value="{!GRE_DI_Code__c.GRE_DI_Code__c}"/> <apex:inputField value="{!GRE_DI_Code__c.Legacy_Institution_Name__c}"/> <apex:inputField id="app" value="{!GRE_DI_Code__c.Application__c}"/> <apex:inputField id="addr" value="{!GRE_DI_Code__c.Address__c}" styleClass="aField"/> <apex:inputField id="acc" value="{!GRE_DI_Code__c.Account__c}"/> <apex:inputField id="city" value="{!GRE_DI_Code__c.City__c}"/> <apex:inputField id="dept" value="{!GRE_DI_Code__c.Department__c}"/> <apex:inputField id="state" value="{!GRE_DI_Code__c.State_Province__c}"/> <apex:inputField id="lvl" value="{!GRE_DI_Code__c.Level__c}"/> <apex:inputField id="zip" value="{!GRE_DI_Code__c.Zip_Postal_Code__c}"/> <apex:inputField id="phone" value="{!GRE_DI_Code__c.Phone__c}"/> <apex:inputField id="status" value="{!GRE_DI_Code__c.Status__c}"/> <apex:inputField id="email" value="{!GRE_DI_Code__c.Primary_Email__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Controller Extension:
public class diCodeCreateExt { Lead lead; Account account; private String lid; public diCodeCreateExt(ApexPages.StandardController controller) { this.lid = ApexPages.currentPage().getParameters().get('lid'); } public Account getAccount() { account = [select id, name from Account where id = :Lead.Account__c]; return account; } public Lead getLead() { lead = [select id, name, account__c, di_code__c, website, institution_address__c, institution_city__c, institution_phone__c, institution_state_province__c, institution_type__c, department__c, institution_zip__c, email from Lead where id = :lid]; return lead; } static testMethod void testdiCodeCreate() { //Here's where we need help!! GRE_Di_Code__c gre = new GRE_Di_Code__c(Name='GRE-Test'); insert gre; System.assertEquals('GRE-Test', [select Name from GRE_Di_Code__c where id = :gre.id].Name); PageReference pageRef = Page.CreateDiCode; Test.setCurrentPageReference(pageRef); ApexPages.currentPage().getParameters().put('lid',gre.id); } }
We were able to successfully construct the Visualforce page and controller extension from the various examples in the force.com Cookbook, force.com Developer Guide, Apex Code Language Reference, and the Visualforce Developer's guide, but we haven't been able to write a successful test method.
Any tips/guidance would be greatfully appreciated!
- CaptainObvious
- March 06, 2009
- Like
- 0
- Continue reading or reply
why does it take soql top populate account field on a new opportunity
Opportunity newOpportunity = new Opportunity(
CloseDate=date.Today(),
StageName='Quoted',
Name='Test Op',
Account=[SELECT Id FROM Account WHERE Id= :newAccount.Id]);
- Erik Rodgers
- June 01, 2015
- Like
- 0
- Continue reading or reply
SOQL Statement
I really need some help here, I have a SOQL statement the grads a specific list of records and child records, but I need to edit the statement to only include those child records that are currently active, I have a check mark box called "Active" on the child record.
Here is my statment:
<soql>select LDC_Account_Number__c, meter_number__c from meter__c where ldc_account__c in (select id from ldc_account__c where opportunity__c='{!ServiceContract.opportunity__r.id}') order by ldc_account_number__c</soql>
meter__c is the child record
name of the field is Active__c
This is only my 5th SOQL statement, still learning, any assistance would be greatly appreciated.
Thank-you
- Shane Quiring
- June 01, 2015
- Like
- 0
- Continue reading or reply
Trying to do something simple with an Onclick Javascript button! Can't get it to work!!
Hi there,
I'm not a developer, but am trying to accomplish something with an Onclick Javascript Button in Salesforce.com for educational purposes. I feel like I'm getting close, but I'm still failing.
The objective here is the following:
Upon clicking this Onclick Javascript Button on the opportunity record, the following actions will occur:
1. Update a checkbox on the opportunity
2. Create a related quote with the quote name field populated to "PQ"
3. Return to the opportunity record when complete
I have the following code, which is only accomplishing 1 and 3:
{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")}
var update_Opp = []; /*Declaring an array to pass the parameters */
var oOpp= new sforce.SObject("Opportunity"); /* Declaring an object for the Case */
oOpp.Id='{!Opportunity.Id}'; /*setting the ID of the object to the Id of the current opp*/
oOpp. Quote_Requested__c = true; /* Setting the checkbox value as true */
update_Opp.push(oOpp); /*pushing the updated object in queue*/
result_Update=sforce.connection.update(update_Opp); /*updating the object*/
window.location.reload(); /* asking the page to refresh */
var newquote= new sforce.SObject("Quote");
newquote.Name = "PQ";
newquote.OpportunityID="{!Opportunity.Id}";
result = sforce.connection.create([newquote]);
alert(result );
window.location.reload();
Can anyone help with where I am screwing this up?
Also, how would I go about making these actions dependent on a condition? Say, if field x on the opportunity was null, prevent the actions from taking place.
Thank you for any help!!!!
- John Braun
- May 14, 2013
- Like
- 0
- Continue reading or reply
Custom button/link throws Insufficient Privileges for users outside of sysadmin profiles
We are revamping cases to be better streamlined with the work flow of our call center agents. As a result we created a custom link of of the Task object to show all open and closed cases, tasks, etc...
The button is a URL link to a report, see below.
Label: View All History
Object Name: Task
Name: View_All_History
Link Encoding: Unicode (UTF-8)
Behavior: Display in existing window without sidebar or header
Display Type: List Button
Button or Link URL: /00Og0000000QXTQ?pv0={!Account.Name}
Why is this only working for Sysadmin profile users and not other users with different profiles? I do not see any reference to Custom buttons/Links in any setting.
URL: https://xxxx.salesforce.com/00Og0000000QXTQ?pv0=Frank+Scerbo+and+Other+Occupants
Error:
Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.
- dvigil
- May 14, 2013
- Like
- 0
- Continue reading or reply
How do I Integrate Apex Code in Web-to-Lead Form?
Good Morning Folks,
Do any of you know how to incorporate Apex code in a HTML Web-to-Lead form so that it execute when the "submit" button is pressed? Down below is a Web-to-Lead form that was generated by SF that I would like to modify so that apex code fires up when pressing the "submit" button. The Apex code will then check if the Lead we are trying to enter already exists in the SF. If it does exist, then it will update the existing Lead record accordingly. Any help will be greatly appreciated. And I will give kudos. I promise
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following <META> element to your page <HEAD>. -->
<!-- If necessary, please modify the charset parameter to specify the -->
<!-- character set of your HTML page. -->
<!-- ---------------------------------------------------------------------- -->
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following <FORM> element to your page. -->
<!-- ---------------------------------------------------------------------- -->
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
<input type=hidden name="oid" value="00DE0000000c06c">
<input type=hidden name="retURL" value="http://">
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: These fields are optional debugging elements. Please uncomment -->
<!-- these lines if you wish to test in debug mode. -->
<!-- <input type="hidden" name="debug" value=1> -->
<!-- <input type="hidden" name="debugEmail" -->
<!-- value="jsiller@ucinnovation.com"> -->
<!-- ---------------------------------------------------------------------- -->
<label for="first_name">First Name</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>
<label for="last_name">Last Name</label><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>
<label for="email">Email</label><input id="email" maxlength="80" name="email" size="20" type="text" /><br>
<label for="company">Company</label><input id="company" maxlength="40" name="company" size="20" type="text" /><br>
<label for="city">City</label><input id="city" maxlength="40" name="city" size="20" type="text" /><br>
<label for="state">State/Province</label><input id="state" maxlength="20" name="state" size="20" type="text" /><br>
<input type="submit" name="submit">
</form>
- DIEHARD
- May 14, 2013
- Like
- 0
- Continue reading or reply
How to wrap apex:columns in a div to use in slideToggle()
Hi All,
I am trying to have a jquery slideToggle() function bound to a row of data in an apex:pageBlockTable.
I am displaying some information in the table and want that if someone clicks on any row, some more information related to that contact is displayed in a slider and the rest of the rows move down. When he clicks again, the slider moves up and everything is back to normal.
If I am not wrong, I think I need to bind row elements (apex:columns) in one div and the information in the slider in the other. But somehow this is not working.
Here is the code:
<apex:page controller="xingShowSearchResult"> <head> <style type="text/css"> #rowInfo,#rows { padding:5px; text-align:center; background-color:#e5eecc; border:solid 1px #c3c3c3; } #rowInfo { width:50px; display:none; } </style> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script> <script> $j = jQuery.noConflict(); $j(document).ready(function(){ $j("#rows").click(function(){ $j("#rowInfo").slideToggle("slow"); }); }); </script> </head> <body> <apex:pageMessages /> <div id='backtoDiv' style="height:20px;"> <apex:outputLink value="/apex/XingPageTab" style="color:blue;">Back to Home Page</apex:outputLink> </div> <apex:pageBlock title="Suche Kontakte"> <apex:pageBlockSection columns="1"> <apex:form style="float:right" > <apex:commandLink style="height:20px;font-weight: bold;" value="Suchergebnisse entfernen" action="{!deleteSearchResult}" /> </apex:form> </apex:pageBlockSection> <apex:pageBlockTable value="{!newList}" var="contacts" id="contactsTable"> <div id="rows"> <apex:column > <apex:image url="{!contacts.photoURL__c}" /> </apex:column> <apex:column headerValue="Name"> {!contacts.displayName__c}</apex:column> <apex:column headerValue="Firma"> {!contacts.firma__c}</apex:column> <apex:column headerValue="Title" > {!contacts.title__c}</apex:column> </div> <div id="rowInfo" > <p> This is the paragraph to end all paragraphs. You should feel <em>lucky</em> to have seen such a paragraph in your life. Congratulations! </p> </div> </apex:pageBlockTable> </apex:pageBlock> </body> </apex:page>
I am trying to understand VF and JS so any help would be appreciated.
Best,
Ankit
- Taneja
- May 14, 2013
- Like
- 0
- Continue reading or reply
How to find apex pages & classes used or referenced by it for debugging.
If we want to fix a bug and we r in a screen and we need to find the classes & page that is using it.
How to find it.
Thanks
Sai
- saisai
- May 07, 2013
- Like
- 0
- Continue reading or reply
Auto populate a form's lookup field based on parent field
Hello!
I am very new to Visual Force, roughly 4 weeks.
I currently am in the process creating of creating a two page wizard. Pretty standard, multiple steps powered by one controller.
Page One of the wizard allows the user to create an item. (Master-Detail Parent)
Page Two of the wizard allows the user to take that same item and add as many sub-items as they wish. (Child)
Here is my only snag. Due to their relation, SUB-ITEM has a lookup field that is based off the ITEM name.
Upon creating the item and landing on page 2, I do not want the user to manually choose the item name in the subitem lookup field again to associate it with the parent.
What are my options?
1) So far I only attempted a preliminary insert statememt of subitem.item__c = item.name__c which gave me the good old string id error. I assume this is because a lookup does not work simply by pulling the string as im sure it related to the ID on the backend.
2) I figured another way to do it would be writing java script to grab the apex:inputhidden item.name text and paste it into the lookup field.
3) Or possibly use a trigger?
I have stewed on this for awhile but I figured I would mention this on the forums as I do not want a band-aid or a quick fix. I want to learn how to do it the write way as this will be a recurring problem as i continue my development.
In advance, I greatly appreciate your assistance!
- EJN5007
- May 04, 2013
- Like
- 0
- Continue reading or reply
Quirky query. ORDER BY clause not working
Anyone have an idea why this query works just fine:
soql = 'SELECT Name,Status__c,Contractor__c,Name_Of_Job__c,Job__r.Type__c FROM Bid__c WHERE name != null'; runQuery(); }
but this one fails:
soql = 'SELECT Name,Status__c,Contractor__c,Name_Of_Job__c,Job__r.Type__c FROM Bid__c WHERE name != null ORDER BY Name_Of_Job__c'; runQuery(); }
I am not seeing the issue with the ORDER BY clause.
- Temple Sutfin
- May 03, 2013
- Like
- 0
- Continue reading or reply
Visualforce Display Issue
Hello:
I have developed the following Visualforce page but nothing is showing up. I assume its a style issues. Any help is greatly appreciated.
<apex:page standardController="CBW_Rev_Share__c" tabStyle="CBW_Rev_Share__c"> <apex:form > <style> .tableStyle {border-collapse: collapse; border-spacing: 0px 0px; } .colStyle1 { width: 33.3%;text-align:right; padding-top:3px; padding-bottom:5px} .colStyle2 { width: 33.3%; padding-left:20px; padding-top:5px; padding-bottom:5px} .colStyle3 { width: 33.4%;text-align:right; padding-top:5px; padding-bottom:5px} .rowstyle { border-bottom-style:solid; border-bottom-width:1px;border-bottom-color:#E8E8E8 } <apex:pageBlock > <apex:pageBlockSection showHeader="true" title="Details" columns="3" id="details"> <apex:panelGrid columns="3" border="0" styleClass="tableStyle" width="100%" columnClasses="colStyle1,colStyle2,colStyle3" rowClasses="rowstyle"> <apex:outputLabel value="Tier One" styleClass="labStyle"/> <apex:outputField value="{!CBW_Rev_Share__c.Tier_One__c}" id="TierOne"/> <apex:outputLabel value="Low End Tier One" styleClass="labStyle"/> <apex:outputField value="{!CBW_Rev_Share__c.Low_End_Tier_One__c}" id="LowEndTierOne"/> <apex:outputLabel value="High End Tier One" styleClass="labStyle"/> <apex:outputField value="{!CBW_Rev_Share__c.High_End_Tier_One__c}" id="HighEndTierOne"/> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </style> </apex:form> </apex:page>
Thanks in advance,
Hampton
- Hampton
- May 03, 2013
- Like
- 0
- Continue reading or reply
Turn off trigger - deploy failing due to errors in test class
Hi All
We're trying to turn off a trigger in our Production org and I've tried the following:
1. Make the trigger Inactive in Sandbox
2. Use the IDE to deploy the trigger to Production
The trigger is designed such that it fires on the insert, update, upsert of an Asset. When the trigger fires, it will call an APEX class to perform th business logic, which is to put the Contact associated to the Asset into a Campaign. The errors we are getting are due to assertion failures (see code below to see the assertion statements). It seems like the tests are failing because the trigger is inactive in Sandbox and so it can't fire and therefore can't inititiate the action to put the Contact into the Campaign, and hence the assertion fails? Does this sound right? If so, how do I disable a trigger which is a dependency on an active APEX test?
Here is the Test Class code:
@isTest
private class XXXXXXXXX Test {
@isTest(SeeAllData=true) static void testContactGetsAddedToControlGroup() {
List<Asset> getAssets = smbNurtureCampaignTest.setup(1239.0,'Timeshare Lease');
List<CampaignMember> controlCampaignMemeber = [Select id from CampaignMember where Campaign.Name='ProDoc Trial Nurture Control Group' and ContactId=:getAssets[0].ContactId];
System.assert(controlCampaignMemeber.size() == 1);
}
@isTest(SeeAllData=true) static void testContactGetsAddedToTestGroup2Group() {
List<Asset> getAssets = smbNurtureCampaignTest.setup(1230.0,'Timeshare Lease');
List<CampaignMember> testCampaignMemeber = [Select id from CampaignMember where Campaign.Name='ProDoc Trial Nurture Test Group 2' and ContactId=:getAssets[0].ContactId];
System.assert(testCampaignMemeber.size() == 1);
}
- jbarraza@rocketlawyer
- May 02, 2013
- Like
- 0
- Continue reading or reply
Failing prod test prevents deployment of a single class with 100% code coverage
I wrote a simple class, and have a test method which in the Force.com IDE is telling me covers this class 100%. When I right-click on the class in the Package Explorer, go to Force.com > Deploy to server... I enter my production credentials and they are validated, then I see that only my class is set to add to the production environment and I go forward with the deployment.
After several minutes, I get a FAILURE message related to one test along the lines of 'too many DML rows', looking into the logs I see there are 10283 rows which exceeds the limit of 10000. I log in to the production environment and run the failing test, and it fails in production too WITH THE SAME ERROR.
Now I have a chicken/egg situation and I don't know how to get any code to production with this failing test, and furthermore, I don't know how anything that would have broken this test would have made it to production! I tried locally commenting out everything in the test class and the deployment failed in the exact same way (to the character) so I know it is not anything locally that I need to change. I did have to fix some things in the test to get it to run locally, but that is irrelevant here especially since I commented the entire body out and got the same error.
HELP!!
Class I'm trying to deploy:
public class AuthorizationToken {
public String LoginId;
public String Password;
public AuthorizationToken(String user, String pw)
{
Password = pw;
LoginId = user;
}
statictestMethodvoid testAuthTokenInstantiation()
{
String user = 'testUser';
String pw = 'testPw';
Test.startTest();
AuthorizationToken testAuthToken = new AuthorizationToken(user, pw);
Test.stopTest();
System.assertEquals(testAuthToken.LoginId, 'testUser');
}
}
FAILING TEST CLASS:
@isTest
public with sharing class generateRenewalOppty_TEST
{
static testMethod void myTest()
{
Boolean success = true;
Account testAccount = new Account();
testAccount.Name = 'Test';
testAccount.Phone = '1111111111';
testAccount.County__c = 'Macomb';
testAccount.Member_Payment_Form__c ='Standard - Cash';
testAccount.Type = 'Membership - New';
insert testAccount;
update testAccount;
Product2 testProduct2 = new Product2(Name='TestProduct', ProductCode = '123', IsActive = true);
insert testProduct2;
List<Pricebook2> testPB2List = [select Id from Pricebook2 where IsStandard = true];
PricebookEntry testPBE = new PricebookEntry(Product2Id = testProduct2.Id, Pricebook2Id = testPB2List[0].Id, UnitPrice = 5.0, UseStandardPrice = false, IsActive = true);
insert testPBE;
Opportunity oppObj = new Opportunity(Name='Test Opp',StageName='Closed Won - In-Kind',CloseDate=System.Today(),AccountId=testAccount.Id, type='Membership - New');
insert oppObj;
OpportunityLineItem testOPL = new OpportunityLineItem(OpportunityId = oppObj.Id, Quantity = 1.0, TotalPrice = 100, PricebookEntryId = testPBE.Id);
insert testOPL;
OpportunityLineItem testOPL1 = new OpportunityLineItem(OpportunityId = oppObj.Id, Quantity = 1.0, TotalPrice = 100, PricebookEntryId = testPBE.Id);
insert testOPL1;
testAccount.Generate_Renewal_Oppty__c = true;
update testAccount;
Opportunity[] oppOpen =[Select Id,Amount from Opportunity Where (StageName='Open' or StageName='Membership - Renewal') and AccountId =:testAccount.Id];
System.assertEquals(1, oppOpen.size());
OpportunityLineItem[] oppLi =[Select Id,TotalPrice from OpportunityLineItem Where OpportunityId=:oppOpen[0].Id];
System.assertEquals(2, oppLi.size());
System.assertEquals(100, oppLi[0].TotalPrice);
System.assertEquals(100, oppLi[1].TotalPrice);
Opportunity[] oppRec = [Select Id from Opportunity];
delete oppRec;
Opportunity oppOb = new Opportunity(Name='Test Opp1',StageName='Open',CloseDate=System.Today(),AccountId=testAccount.Id);
insert oppOb;
testAccount.Generate_Renewal_Oppty__c = true;
update testAccount;
Opportunity[] oppRec1 = [Select Id from Opportunity];
THIS IS LINE 52: delete oppRec1;
Opportunity oppOb1 = new Opportunity(Name='Test Opp1',StageName='Open',CloseDate=System.Today(),AccountId=testAccount.Id,Type = 'Membership - New');
insert oppOb1;
testAccount.Generate_Renewal_Oppty__c = true;
update testAccount;
//delete oppOpen;
}
}
TEST RESULT DETAIL:
Class: generateRenewalOppty_TEST
Method Name: myTest
Pass/Fail: Fail
Error Message: System.LimitException: Too many DML rows: 10001
Stack Trace: Class.generateRenewalOppty_TEST.myTest: line 52, column 1
- koppinjo
- May 02, 2013
- Like
- 0
- Continue reading or reply
Invalid field Training_Course_Plan_FCS__c for SObject Initiative_Settings__c
Hello
I have the following two sections of code that I need to understand. Initiative_settings__c is not a standard object or custom object that I can see in SF. But I can see the scheme through Eclipse. The scheme has fields in it. One of which is ANN_Marketing__c which is referenced in the second set of code? How is this sObject Built and how do I add additional fields to it?
private Initiative_Settings__c getInitiativeSettings() {
return Initiative_Settings__c.getInstance();
}
public boolean getContainsAnnMarketingCampaigns() {
return getInitiativeSettings().ANN_Marketing__c && !getAnnMarketingCampaigns().isEmpty();
}
public List getAnnMarketingCampaigns() {
return filterList('ANN Marketing');
}
- law
- May 02, 2013
- Like
- 0
- Continue reading or reply
Removing None Option in PickList visualforce apex
i have created an object with name PS_Detail__c .in this custom object i created a custom field of picklist type.in this picklist i defined two values Dollar ,Unit. when i go to P/S Detail Tab for creating a new PS_Detail__c object then i get None also as a value in picklist field .i want only Dollar and Unit as Picklist values .some one please help how to remove this None from Picklist
- Ritesh__
- April 19, 2013
- Like
- 0
- Continue reading or reply
Populating Lookup field on LEADS object using Web To Lead or Web Form.
Hi there,
We have a lookup field on LEADS point to Accounts. The Web To Lead Form does not display the Lookup field called "Reseller", and I am not sure what HTML element should be used to grab the data from the Web Form and then populate into the look up field into LEADS object.
We have tried using something like this:-
Reseller:
Reseller:<input id="00N80000004nbGG" maxlength="100" name="00N80000004nbGG" size="20" type="text" /><br>
This is not working.
On the Web Form the field Reseller is a picklist while in SFDC we are trying to populate into lookup field.
How should this be resolve, what do we need to do on our web form to populate this value into SFDC under the lookup field.?
- sudha76
- January 10, 2013
- Like
- 0
- Continue reading or reply
Problem with validation rule for forecatsed amount
I wrote this rul but it is not working correctly. When a salesman in converting a lead to a opportunity i want the forcasted amount to be greater than zero. See detail below. Validation Rule Detail |
Review all error messages below to correct your data.
Rule Name | Forecasted_Amount | Active | |
Error Condition Formula | AND( NOT(ISNEW()), ISBLANK(Amount)) | ||
Error Message | To save a new Opportunity. The forecasted $ amount needs to be greater than $0. If you do not know at least the ballpark range for sales, it is not yet an Opportunity, but a lead that requires further qualification. | Error Location | Amount |
Description | Amount Forecasted for Opportunity is less than $0. All Opportunities must have a forecasted $ amount | ||
Created By | , 10/12/2011 9:47 AM |
- Murphman
- December 29, 2011
- Like
- 0
- Continue reading or reply
Unable to fetch and save Force.com Components to Project
Hi,
Unable to fetch and save Force.com Components to Project: com.salesforce.ide.api.metadata.types.Metadata$JaxAccessorF_fullName cannot be cast to com.sun.xm.internal.bind.v2.runtime.reflect.Accessor
Abort or Continute Force.com project creation?
==============
while i am creating a new force.com project i got this error: can u please tell me why this error came. i downloaded eclipse and added force.com ide.... when i try to creating a new force.com project i got this error... and i am able to create a force.com project but not getting all existing classes and pages. And not added my new page or class content to the sever when i save. Is it required any other software installations?
- SFDC_Learner
- September 10, 2011
- Like
- 0
- Continue reading or reply
Consolidating Web-to-lead form fields
I would like my leads to fill a medical from, which has about 30 yes / no questions and some open lines.
I wouldn't like to create a field for each of these. what's a smart way to do this?
I thought perhaps there is a way to compile these fields into one big text document, in which each question and it's answer would be written line after line.
it can then be sent to salesforce as one single large text file.
Any Ideas on how I should implement this?
Thanks
- beener
- October 07, 2008
- Like
- 0
- Continue reading or reply