-
ChatterFeed
-
14Best Answers
-
0Likes Received
-
0Likes Given
-
9Questions
-
198Replies
System.QueryException: List has no rows for assignment to SObject in TestClass
I am getting error while running Tests
/** * Method that creates the test estimate object */ public static Services_Estimate__c createTestEstimate(){ Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps']; Services_Demand_Management__c dm= new Services_Demand_Management__c (Name = 'MyTestEstimate', Request_Status__c = DemandManagementHelper.STATUS_NEW, Request_State__c = DemandManagementHelper.STATE_OPEN, Comments__c = 'My Desc', ACI_Product1__c = prod.Id, Request_Type__c = 'Services', Oracle_Project_Number__c = 'TP00001', Oracle_Project_Name__c = 'Test Project', Request_Sub_Type__c = ServicesEstimateHelper.IAE_FULL, Request_Submitter__c = UserInfo.getUserId()); insert dm; Services_Estimate__c est= new Services_Estimate__c(Name = 'MyTestEstimate', Estimate_Status__c = DemandManagementHelper.STATUS_NEW, Request_Description__c = 'My Desc', Demand_Management_Request__c = dm.Id); insert est; Services_Review_Meeting__c meeting = new Services_Review_Meeting__c(Estimate_In_Review__c = est.Id, Meeting_Date__c = Date.today(), Meeting_Description__c = 'Review IA', Meeting_Goal__c = 'Reach Agreement', AD_Comments__c = 'Done', AD_Review_Disposition__c = 'Agree', Product_Review_Disposition__c = 'Agree', Sales_Review_Disposition__c = 'Agree', Services_Review_Disposition__c = 'Agree'); insert meeting; return est; } public static testMethod void testReadEstimate(){ Services_Estimate__c est= createTestEstimate(); readEstimates(est.Demand_Management_Request__c); readEstimate(est.Id); readEstimateItems(est.Id); readReviewMeetings(est.Id); readEstimateFunctionalFeatureMappings(est.Id); } }
Message shows that error occurs at Line 252 which is line below , but this query is returning a single result ,I am not sure why this error is appearing. Can some one pls. help me ?
Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps'];
- SandeepV
- December 21, 2012
- Like
- 0
- Continue reading or reply
OnClick JavaScript Button does not create task correctly
Hello everyone,
I have created a JavaScript button which is creating a curious effect. Upon clicking the button, it should create a task alerting another user that a lead is ready for their review. The fields should auto populate with the other users Name and Lead info through the use of a URL hack.
Instead, when the task is created, it notifies the creator of the task and attaches to a Contact of the same name as the lead. I find that if I click the magnifying glass next to the Assigned to User Field and the Name Lead field it works correctly. Any idea what might cause this or how to correct it?
Below is the button code. Thank you for your help,
if ({!Lead.Description} == "ceuenrollment") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=CEU%20Order";
}
else if ({!Lead.Description} == "certrenew") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=Cert%20Renewal";
}
else if ({!Lead.Description} == "certreplace") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=Replacement%20Display%20Certificate%20Request";
}
else {
alert("This lead can not be marked as paid.");
}
- gthyaer
- August 30, 2012
- Like
- 0
- Continue reading or reply
Displaying Account custom field in a Contact page layout
We have a Long Text Area custom field on Account called "Account Notes" would like to display that on page layout of Contacts related to that Account but can't figure out how to do so. I attempted to use a forumla field to display it but Long Text Area fields aren't allowed there so I am stuck. Any ideas on how to do this would be much appreciated.
Thank you!
- AdamSBeal
- April 16, 2012
- Like
- 0
- Continue reading or reply
Dynamic SOQL query result
Hi,
I would get the values from dynamic soql query. here in detail
XmlRD__c queryResult = Database.query('Select \''+field +'\' from XmlRD__c where id = \''+ recordid +'\'');
String Text = String.valueof(queryResult.field);
Here the red marking field values getting dynamically changing. i want to get the dynamic field value. but here throwing the issue. How can i get.
- Rajiii
- December 29, 2011
- Like
- 0
- Continue reading or reply
SerializationException
hii,
System.SerializationException: Not Serializable: ApexPages.Message
i initialze message object as a class variable....what should i have to do to remove this exception?
tahnks
- Ranu Jain
- December 27, 2011
- Like
- 0
- Continue reading or reply
string updateOpp(string oId, string fieldName, string fieldValue) {} - Is this possible?
Hi team,
I am trying to figure it out if this is possible?
WebService static string updateOpportunity(string oppId, string fieldName, string fieldValue) { try { integer i = Database.countQuery('select count() from Opportunity where Id = :oppId'); if (i > 0) { Opportunity o = [select :fieldName from Opportunity where Id = :oppId limit 1]; o.fieldName = fieldValue; update o; return 'OK'; } } catch (DmlException e) { return string.valueof(e); } }
someone gets the idea... is this possible?
please post or sms me.
- edwin_beltran
- December 13, 2011
- Like
- 0
- Continue reading or reply
MAPS
Hi all anyone see what stupid mistake im making here?
Ive got a map:
map<string, Consultant__c> ConsultantMap = new map<string, Consultant__c>([select name, id from Consultant__c]); //this seems to work fine.
and all i want to do is use the value from a pick list as the key, so if i select 'Darth Vader' it uses that as the key and gets me the id.
now i've tried:
UsersId = ConsultantMap.get(pa.Login_As__c).id;
and even
Consultant__c X = ConsultantMap.get('Darth Vader');
system.debug('X' + X.Id);
but every time it fails and the id is null. yet the map is populated ok. I dont get what im going wrong.
Thanks All
- Micky M
- December 11, 2011
- Like
- 0
- Continue reading or reply
How to use apex:actionFunction
Hi im trying to find an alternative to
<apex:page standardcontroller="Shipment" action="{!agree}"> </apex:page>
by using apex:actionFuntion so that the code looks something like this
<apex:page standardcontroller="Shipment" > some code... ... <apex:actionFucntion name="agree" action="{!agree}"/> </apex:page>
can someone help me?
- kmorf_entransform
- November 16, 2011
- Like
- 0
- Continue reading or reply
get() method
I would like to know how one would use the get() method attached to Objects. It seems like something that I might want to use.
- DannyK89
- November 07, 2011
- Like
- 0
- Continue reading or reply
How to display HTML content in Visual force page
Hi Everybody,
I have created a VF page ccontroller(i.e a Apex class) which is returning a String Variable containing some HTML content,
But when i am displaying that String variable in VF page , it is showing the output in different format.
Example--
Apex class Code
String HTMLContent='<b>Hello World</b>'
public String getContent(){
return HTMLContent;
}
VisualForce Page Code
{!Content}
It is showing the output like that "<b>Hello World</b>"
But i want to display the Hello World in bold letter(like html format)
When i am execute and view the Page output in FireBug, The String is like that
<b>Hello World </b>
I need help,
- Dipak
- October 14, 2011
- Like
- 0
- Continue reading or reply
Adding a inputField to a list in Apex/Visualforce
Hi,
I have a Visualforce page that lists all the products for a given opportunity in a apex:pageBlockTable
I want to add a column called "Quantity to order" which will be used in my controller to create some new objects. This field does not exist in the OpportunityLineItem object.
How do I add an additional inputText field to my pageBlockTable and have it bound to my controllerExtension, when it is not actually a field in Salesforce?
Ideally I'd like to programatically add a new Integer to the Opportunity.OpportunityLineItems List.
Thanks,
-Jev
- Jev
- September 10, 2011
- Like
- 0
- Continue reading or reply
How to Update a User & Set a Reference ID to empty
Hi,
Within ym user object I have reference fields such as "Approval Manager ". This field is a refence to the user object & by entereing a user id it displays the user's name as the manager.
I wish to set this value to empty using APEX code if data I retrieve (from a source external to SFDC) indicates no Approval Manager is provided. I receive an error saying I'm assigning an invalid ID
my 2 lines of code are
usr.Approval_Manager__c='';
update usr;
Does anyone know if I can set this to blank threfore?
Thanks
- RedSales
- September 09, 2011
- Like
- 0
- Continue reading or reply
How do I include a commandButton with no action no server call in a VF page.
I have a confirmation dialog with Ok and Cancel button. When user clicks OK I would call server action to proceed and on cancel no server call is necessary.
I want to use the apex:commandButton for both to make sure that they use the same css style. Even if I do not have the action parameter the command submits a call to the server.
- dipu
- August 29, 2011
- Like
- 0
- Continue reading or reply
Http Post to a Site VF Page
I have a requirement to allow third party lead providers to post XML lead data to our application and convert that into a custom object. I currently have it working by having the test client application attach the XML string as a query parameter:
(&leaddata=< ... xml ... />), and sending the httprequest without anything in the body of the post.
However, I don't think this is the expacted (or correct) way to post data to the site page. I would think the correct method would be to add the XML in the body of the "POST". The page controller uses the "getParameters()" method then uses the XML Dom to parse the XML. Everything works well after that.
My question is:
How would I get hold of the incomong HTTPRequest in the page controller to grab the body of the request?
I would expect something like this:
public MyController { private string XmlString; public MyController() { HTTPRequest IncomingRequest = Pages.CurrentPage.GetRequest(); Blob BodyBlob = IncomingRequest.getBody(); XmlString = BodyBlob.ToString(); } }
- JPClark3
- August 20, 2011
- Like
- 0
- Continue reading or reply
SF integration with Gmail ?
Can anyone give some insights on how to connect to gmail from Salesforce ?
- hemantgarg
- February 06, 2013
- Like
- 0
- Continue reading or reply
WebService Callout mock does not seem to work
- hemantgarg
- January 20, 2013
- Like
- 0
- Continue reading or reply
Can we check map contains key on visualforce page ?
Can we check map contains key on visualforce page ?
- hemantgarg
- August 07, 2012
- Like
- 0
- Continue reading or reply
decreasing compiled size of that formula ?
If we use a formula field in another formula field, then will it decrease the compiled size of second formula field?
Actually I am working on a formula field which is giving me error of exceeding compiled size, to overcome this error,
I created a small formula field and want to use it in my original field.
I was thinking that it can decrease the compiled size, but it does opposite, it increased the compiled size. can anyone suggest how to minimize the compiled size of a formula field ?
- hemantgarg
- April 10, 2012
- Like
- 0
- Continue reading or reply
How to retrieve deployment error log while using Migration Tool ?
Force.om migration tool is great tool for deployment, I found it faster than any other method, But there is one issue , in case if deployment fail it does not give you error logs(cause of failure of deployment). Is there any way we can get/generate error logs of deployment ?
Thanks in advance!!
- hemantgarg
- April 03, 2012
- Like
- 0
- Continue reading or reply
@RemoteAction function is failing to connect
Hi
I have tested and implemented Remote Action on visualforce page, It was working perfectly that time. But now I am shocked to see the same is failing with returning error message "Unable to connect to the server" . Does anyone else see this behaviour, please let me know.
- hemantgarg
- January 11, 2012
- Like
- 0
- Continue reading or reply
Not able to create Idea object in test class
I am trying to create an Idea object in test class as a customer portal user. but getting following error:
System.DmlException: Insert failed. First exception on row 0; first error: COMMUNITY_NOT_ACCESSIBLE, You do not have permission to access the community that this entity belongs to. You must be given permission to the community before you can access this entity.: [CommunityId]
I am using following apex code in test class:
List<Community> listCommunity = [Select c.Name, c.IsActive, c.Id From Community c where IsActive=true and name=:TestClassUtility.PORTAL_COMMUNITY_NAME limit 1];
System.runAs(portaluser){
Idea myIdea = new Idea(CommunityId = listCommunity.get(0).Id);
myIdea.title = ' Test Idea';
myIdea.body = ' test idea';
insert myIdea;
IdeaComment iComm = new IdeaComment(IdeaId = myIdea.Id);
iComm.CommentBody = ' I like this idea';
insert iComm;
}
Thanks in advance for any help.
- hemantgarg
- March 06, 2011
- Like
- 0
- Continue reading or reply
Associating CRM Content with custom objects.
Ho can we associate(attach/detach) crm content "ContentVersion" records to some custom object programatically?is there any method exposed to attach/detach in API?
- hemantgarg
- July 15, 2010
- Like
- 0
- Continue reading or reply
How to get the created portal user logged-in to site
I am working on site pages .In an apex class I am creating a contact and then a portal user , Now immediately after that I need to get logged-in the recently created portal user on the site, Can anyone suggest , How can I get it ?
- hemantgarg
- June 14, 2010
- Like
- 0
- Continue reading or reply
BLOB is not a valid UTF-8 string and € symbol
Hi to all.
I'm trying to build a loader for csv file. As you can see from the code I load my csv file in an attachment. After I take the body of the attachment and insert it into a string using the toString (). I noticed that when in the csv file there is the € symbol I get an exception of type 'BLOB is not a valid UTF-8 string'. Do you have any suggestion?
My Controller
public with sharing class DocumentwithEuroController { public Attachment document { get { if (document == null) document = new Attachment(); return document; } set; } public PageReference checkFile() { String fileBody = ''; try{ fileBody = document.body.toString(); system.debug(fileBody); }catch(exception e){ if(e.getmessage() == 'BLOB is not a valid UTF-8 string'){ ApexPages.addMessage(new ApexPages.message(ApexPages.severity.WARNING, 'In the csv file there are stressed symbols. The upload is blocked')); } } return null; } }
My page.
<apex:page controller="DocumentwithEuroController" > <apex:form > <apex:pageMessages id="pms1" /> <label for="ifl" style="text-align: left; font-weight: bold; padding-right: 0.69em;">Selezionare il file tracciato(.csv):</label> <apex:inputFile id="ifl" value="{!document.body}" filename="{!document.name}" styleclass="btn" /> <apex:commandButton value="Load csv" action="{!checkFile}" status="loadCsv" /> </apex:form> </apex:page>
For me is very important, i must resolve this proble by tomorrow
Tanks to all,
FP
- bibbo84
- December 25, 2012
- Like
- 0
- Continue reading or reply
System.QueryException: List has no rows for assignment to SObject in TestClass
I am getting error while running Tests
/** * Method that creates the test estimate object */ public static Services_Estimate__c createTestEstimate(){ Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps']; Services_Demand_Management__c dm= new Services_Demand_Management__c (Name = 'MyTestEstimate', Request_Status__c = DemandManagementHelper.STATUS_NEW, Request_State__c = DemandManagementHelper.STATE_OPEN, Comments__c = 'My Desc', ACI_Product1__c = prod.Id, Request_Type__c = 'Services', Oracle_Project_Number__c = 'TP00001', Oracle_Project_Name__c = 'Test Project', Request_Sub_Type__c = ServicesEstimateHelper.IAE_FULL, Request_Submitter__c = UserInfo.getUserId()); insert dm; Services_Estimate__c est= new Services_Estimate__c(Name = 'MyTestEstimate', Estimate_Status__c = DemandManagementHelper.STATUS_NEW, Request_Description__c = 'My Desc', Demand_Management_Request__c = dm.Id); insert est; Services_Review_Meeting__c meeting = new Services_Review_Meeting__c(Estimate_In_Review__c = est.Id, Meeting_Date__c = Date.today(), Meeting_Description__c = 'Review IA', Meeting_Goal__c = 'Reach Agreement', AD_Comments__c = 'Done', AD_Review_Disposition__c = 'Agree', Product_Review_Disposition__c = 'Agree', Sales_Review_Disposition__c = 'Agree', Services_Review_Disposition__c = 'Agree'); insert meeting; return est; } public static testMethod void testReadEstimate(){ Services_Estimate__c est= createTestEstimate(); readEstimates(est.Demand_Management_Request__c); readEstimate(est.Id); readEstimateItems(est.Id); readReviewMeetings(est.Id); readEstimateFunctionalFeatureMappings(est.Id); } }
Message shows that error occurs at Line 252 which is line below , but this query is returning a single result ,I am not sure why this error is appearing. Can some one pls. help me ?
Product2 prod = [SELECT ID, NAME FROM Product2 WHERE NAME = 'BASE24-eps'];
- SandeepV
- December 21, 2012
- Like
- 0
- Continue reading or reply
Parsing the string response and get the url only
Hi
I am getting the response has below when i send an http request .
am getting response has text data andin that url also .now i want to get the url from the response. only please can u help me
I am sendng an example of response
string response='the report has generated to sai and and ready to access the data ..etc.after this amgetting an url http://www.abcadef.com/abc.asp?id=1 after these url am getting thanking you';
In these above response i want get only url from the response.please can u say me,
thanks in advance
- saii
- December 21, 2012
- Like
- 0
- Continue reading or reply
Should Test Class Have Try Catch Blocks?
From a best practice perspective, should the test class have any Try...Catch blocks or are all of these in the production classes and Triggers?
It seemed to me like the test class should not have Try...Catch blocks but I keep seeing these in examples. Isn't purpose of these so the code catches them?
Thanks!
- DarrellD
- November 06, 2012
- Like
- 0
- Continue reading or reply
How to formate currency in Visualforce with a wrapper class.
We have a quote template (a visual force page that renders as a PDF). This page currently uses the MessageFormat class from Java to format the currency fields on the quote.
Here is the Visualforce example of how the Unit price on a product line item is formatted:
<apex:column headerValue="Unit Price">
<apex:outputText value="{0, number, $###,###,##0.00}">
<apex:param value="{!item.ListPrice}"/>
</apex:outputText>
</apex:column>
Note that <apex:outputText value="{0, number, $###,###,##0.00}"> gives back a USA currency format of $1,000.00. However, I need to have this be €###.###.##0,00 where the value comes out as €1.000,00. Note the position of the comma and period in the string. It has been determined that the Java MessageFormat class will not work with other locations outside of the US. So I need another solution.
I have found some code in the Force.com Cookbook that will work to convert the decimal string into a Euro format:
Decimal Amount = 199850010.28;
Decimal dollars;
Decimal cents;
dollars = Amount.intValue();
system.debug('Dollars is set to:' + dollars);
cents = Amount - dollars;
cents = cents.setScale(2);
system.debug('cents is set to:' + cents);
String AmtText = dollars.format()+','+ cents.toPlainString().substring(2) + ‘€’ ;
System.debug(AmtText);
199.850.010,28 €
I need help converting this code into a method inside of my Visualforce page controller. Also, I don’t know how link the output of this method to the appropriate line item values on the quote page. It has been suggested by Salesforce Support that a wrapper class would do the dirty work. However, I have no experience with how to make a wrapper class work, nor how to use the above code within the wrapper class to format all of the currency fields (List Price, Discount Price, Discount Amount, Subtotal Amount, etc.) on our quote.
Does anyone have a custom code example, or techniques for formatting currency in a Visualforce page so that Euros display properly? I’m sure someone, somewhere has run into this requirement before since Salesforce is an international company. Please share how you resolved this issue when using a Visualforce page template.
- Kent Manning
- November 06, 2012
- Like
- 0
- Continue reading or reply
IF () on VF Page
Hi,
How to use something like this..
<td >
<apex:outputText value="{0, number, $###,###,###,##0.00}">
<apex:param value="{!IF(list.size>1,list[1].FieldValue,'$0.00')}"/>
</apex:outputText>
</td>
Thanks
- skyfall007
- November 06, 2012
- Like
- 0
- Continue reading or reply
How to Display list of Sobject in visualforce
I wrote some code but unable to display in vf
vf:
-------------------------------------------
<apex:pageBlockTable value="{!get}" var="get_var" rendered="{!get_ren}">
<apex:column value="{!get_var.name}"/>
</apex:pageBlockTable>
class:
-------------------------------------------
list<SObject> selrec= new list<SObject>();
accrec=[select id,name,check__c from account limit 10];
conrec=[select id,lastname,check__c from contact limit 10];
public PageReference Addtoselectedlist() {
get_ren=true;
for(account a:accrec){
if(a.check__c==true){
selrec.add(a);
}
}
for(contact c:conrec){
if(c.check__c==true){
selrec.add(c);
}
}
return null;
}
public sobject[] getGet() {
return selrec;
}
- Raviteja
- November 06, 2012
- Like
- 0
- Continue reading or reply
Something like web-to-lead for custom objects
the goal:
Collect website visitors contact information (first name, email) and store it in force.com custom object (consumers).
There are multiple different websites and the visitors contact information would have to be associated with the website they were visiting and submitting the form from.
Is there a declaritive way to do this on Force.com or is this only accomplished through code?
Thanks
Chris
- TrafficApp
- November 05, 2012
- Like
- 0
- Continue reading or reply
What version controller Used for salesforce?
interview Question:What is Version controller and what version controler we used in Salesforce?
- Sfdc@Smitha
- October 15, 2012
- Like
- 0
- Continue reading or reply
OnClick JavaScript Button does not create task correctly
Hello everyone,
I have created a JavaScript button which is creating a curious effect. Upon clicking the button, it should create a task alerting another user that a lead is ready for their review. The fields should auto populate with the other users Name and Lead info through the use of a URL hack.
Instead, when the task is created, it notifies the creator of the task and attaches to a Contact of the same name as the lead. I find that if I click the magnifying glass next to the Assigned to User Field and the Name Lead field it works correctly. Any idea what might cause this or how to correct it?
Below is the button code. Thank you for your help,
if ({!Lead.Description} == "ceuenrollment") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=CEU%20Order";
}
else if ({!Lead.Description} == "certrenew") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=Cert%20Renewal";
}
else if ({!Lead.Description} == "certreplace") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=Replacement%20Display%20Certificate%20Request";
}
else {
alert("This lead can not be marked as paid.");
}
- gthyaer
- August 30, 2012
- Like
- 0
- Continue reading or reply
Problem setting values on a VF page via Javascript
Hi all,
I'm trying to build a custom button on a page layout for a custom object that calls javascript that updates other fields on the page. I defined the behavior as "execute javascript" and the Content Behavior as "OnClick Javascript". The source is simple;
<script language="JavaScript">
try { {!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} {!Appointment__c.Confirmed_Date__c}={!Appointment__c.ApptDate__c} ; {!Appointment__c.Confirmed_Time__c}={!Appointment__c.ApptTime__c} ; } catch(err){ alert(err); }
</script>
...But I keep on getting a popup that says "syntax error" - help?
- kevindotcar
- August 08, 2012
- Like
- 0
- Continue reading or reply
How to find Merge event in Trigger
Hi,
i am doing standered salesforce functionality of Merge ,that time can i find any call in controller or trigger ? if it is posible ple tell me
thanks®ards.
Bondi
- Bondicloud
- August 07, 2012
- Like
- 0
- Continue reading or reply
Basic http authentication for Salesforce?
Hi,
is there a way to authenticate an application for using the salesforce rest api with just the normal username / password credentials from
the basic http authentication?
I know thats not safe but its just for testing the functionality of my application.
best regards
Elmar
- Elmar
- June 27, 2012
- Like
- 0
- Continue reading or reply
sort wrapper list
Hi,
I have a wrapper list which contains an integer value, a product record and a boolean value.
my requirement is to sort that list according to the product name..
please help...its urgent.
Thanks in advanced
- puja
- May 19, 2012
- Like
- 0
- Continue reading or reply
Is Salesforce support claim Based authentication.
Hi,
We are planning to implement custom interface to open incident for our client. For that we are going to follow claim based authentication.
So I want to know is sales force support claim based authentication .
Thanks,
Pramod
- Pramodsarwar
- April 26, 2012
- Like
- 0
- Continue reading or reply
MAPS
Hi all anyone see what stupid mistake im making here?
Ive got a map:
map<string, Consultant__c> ConsultantMap = new map<string, Consultant__c>([select name, id from Consultant__c]); //this seems to work fine.
and all i want to do is use the value from a pick list as the key, so if i select 'Darth Vader' it uses that as the key and gets me the id.
now i've tried:
UsersId = ConsultantMap.get(pa.Login_As__c).id;
and even
Consultant__c X = ConsultantMap.get('Darth Vader');
system.debug('X' + X.Id);
but every time it fails and the id is null. yet the map is populated ok. I dont get what im going wrong.
Thanks All
- Micky M
- December 11, 2011
- Like
- 0
- Continue reading or reply
Test Coverage for StandardSetController Class .How i can coverage it in my code
List<Custom Object> variable1 = (List<Custom Object>)xyz.getSelected(); I am getting the p_stdSetController from my constructor here is the code ApexPages.StandardSetController xyz. List<Custom Object> variable1 = (List<Custom Object>)xyz.getSelected(); this line is hitting the code coverage .
- gv007
- May 26, 2009
- Like
- 0
- Continue reading or reply
Deploying Apex "Generate From WSDL" Class w/o Unit Tests
- ForceUser123
- February 06, 2008
- Like
- 0
- Continue reading or reply