• lvivanin
  • NEWBIE
  • 78 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 26
    Questions
  • 62
    Replies
Hi what should be the date format when using the data loader to upload records from a csv file converted by excel?

Hi,

 

I wanna create a form who allows the creation of multiple records in one time, for example 10 opportunities or 10 contacts.

  • June 16, 2009
  • Like
  • 0

Hello,

 

I have created a custom button with a VFpage as:

 

setup->create->objects->objectName->customButtons and Links->Detailedbutton->contentSource->VFpage->Behaviour->Display in New window .

 

Now,Here i am able to open a VF page which has some default size.How can i set my own size to this popup window.

 

This might be simple but I am not able to get throuh this....Help me out guyz of this issue.. 

Thaks in Advance. 

  • June 15, 2009
  • Like
  • 0

I am doing simple test on action with in the <apex: page>


I have a word file uploaded under the Static Resource named customerhelp

 

 

 

<apex:page action="{!URLFOR($Resource.customerhelp)}">
<p>
Hello world!
</p>
<apex:form >
<apex:commandButton title="Sample Button" value="Sample Button"/>
</apex:form>
</apex:page>

 

1. When I load this page a popop window is displayed to dowonload/open the file within the Static Resource.
2. After that action is done by clicking OK/Cancel page remains blank.

If I try to do refresh/backward it just repeats the steps 1 & 2 . Not only it doesn't show the sample button and the 'Hello  world' text, but also does not allow to navigate to the other pages...

 

 

How can I download/open or Cancel at first (only one time ) and then see the rest of the content on the page?

 

Thanks in advance.

 


first of all, can any body explain/show the steps on how to post a screenshot as part of the message on this community. i can see people doing this but i am unable to do so.

 

anyway i try to explain in words:

 

i am trying to display an error message

 

 

 

<apex:inputText value="{!subject}" id="Subject" maxlength="80" required="true" id="Subject_Validation"/>

<apex:message for="Subject_Validation" styleClass="locationError" />

 

 it works fine but i am getting it in Awkward format  - why j_id0:j_id2:j_id11:

 

j_id0:j_id2:j_id11:Subject_Validation: Validation Error: Value is required.

 

its same for IE/Mozilla.

 

any suggestion where i am wrong.

 

 

 

Force.com Apex Code Developer's guide says - test methods commit no data to the database, send no emails, which is obvious.


I do e-mail testing in salesforce using my e-mails and sometimes friend's emails who work with me. If everything(incliding templates's look and feel) works as supposed to be I do deployment in the prod. But I am looking for a formal way of testing it - like we test our normal class/triggers.

We can use System.assert(....) in this case. But how to assert inbound/outbound emails(w/out attachments) worked?

I am creating Cases using Email-To-Case. How can I link another incoming email(s) to an existing case?

 

any suggestions?

My requirement is:

 

- create Case using Email-to-Case

- attach the Email attachments (if any) to the newly created Case as Attachments

 

is there a way i can attach the email attachments to the newly created Case in Apex?

 

Thanks in advance.

I am trying to follow the link

 

 Best Practice #6: Querying Large Data Sets states:

 

SOQL queries that return multiple records can only be used if the query results do not exceed 1,000 records, the maximum size limit of a list. If the query results return more than 1,000 records, then a SOQL query for loop must be used instead, since it can process multiple batches of records through the use of internal calls to query and queryMore.

For example, if the results are too large, the syntax below causes a runtime exception:

//A runtime exception is thrown if this query returns 1001 or more records.
Account[] accts = [SELECT id FROM account];

Instead, use a SOQL query for loop as in one of the following examples:

// Use this format for efficiency if you are executing DML statements 
// within the for loop
for (List<Account> accts : [SELECT id, name FROM account
WHERE name LIKE 'Acme']) {
// Your code here
update accts;
}

Let the Force.com platform chunk your large query results into batches of 1000 records by using this syntax where the SOQL query is in the for loop definition, and then handle the individual datasets in the for loop logic.

 

 --------------------------------------------------------------------------------------------------------------------

 

I have a test object with more than 1000 test records on it.  The test trigger is

 

trigger testProfileEffect on ProfileBasedTest__c (before insert)
{
for(List<ProfileBasedTest__c> pbt:[SELECT description__c FROM ProfileBasedTest__c])
{
pbt[0].description__c = 'Hello world!';
update pbt;
}


}

 

As a test, i am trying to update the existing record's description fields while inserting a new record & get exception:

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger Test.testProfileEffect caused an unexpected exception, contact your administrator: Test.testProfileEffect: execution of BeforeInsert caused by: System.Exception: Too many query rows: 1001: Trigger.Test.testProfileEffect: line 3, column 38

 

 

 The exception is because of List limitation but how can I make the Best Practice #6: Querying Large Data Sets workable in this scenerio?

 

Thanks in advance.

 

 

 

How can we throw exception in Apex. I am trying do something like:

 

 

 

 

public class testExpt
{
public void exptTesting(Test_Object__c[] testObjectArray)
{
for (Test_Object__c t: testObjectArray)
{
if(t.test_field__c < 25.00)
{
throw new Exception('This is bad number');
}
}
}
}

 

 

 How can I achieve this in Apex?

 

After reading the documentation I did following

1. created sample CSS file named customStyles.css:

 

<style type="text/css">
body { background-image: url("images/SFSummary.gif") }
</style>

 

 2. Zipped up the images folder and customStyles.css together as myStyles.zip

 

 3.  Uploaded myStyles.zip as Static Resources with the name myStyles

 

 

 4. Referenced the stylesheet in visualforce page:

 

<apex:page standardController="Mileage__c" extensions="MileageExtension" tabStyle="Mileage_Custom_View__tab" standardStylesheets="false" >
<apex:stylesheet value="{!URLFOR($Resource.myStyles, 'customStyles.css')}"/>
.......
.......
.......

 

 It does not work. Couldn't figure out .....

 

 

 

 

 

I am trying execute action when the page loads. I want to display the details of a record Id (for testing purposes i have hardcoded the Id).

 

public class MileageExtension {
private final Mileage__c mileageObj;
public MileageExtension(ApexPages.StandardController controller) {
this.mileageObj = (Mileage__c)controller.getRecord();
}
public Mileage__c[] getTodaysMileageRecords() {
String createdbyId = UserInfo.getUserId();
Mileage__c[] mileageList =
[SELECT name, miles__c
FROM Mileage__c
WHERE Date__c <= TODAY
AND createdbyid = :createdbyId];
return mileageList;
}

public PageReference InitMileageCustomview() {
PageReference secondPage = Page.MileageCustomview;
secondPage.setRedirect(true);
secondPage.getParameters().put('id','a008000000CqtDd');
return secondPage;

}

}

 And My Page is

 

 

 

<apex:page standardController="Mileage__c" extensions="MileageExtension" action="{!InitMileageCustomview}">
<h1>{!$User.FirstName}'s Mileage Page</h1>
<apex:pageBlock >
<apex:pageBlockSection title="Today’s Mileage Records">
<apex:dataTable value="{!TodaysMileageRecords}"
var="mileage" styleClass="list">
<apex:column >
<apex:facet name="header">Name</apex:facet>
<apex:outputText value="{!mileage.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Miles</apex:facet>
<apex:outputText value="{!mileage.Miles__c}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:detail subject="{!Mileage__c.Contact__c}" relatedList="false"/>
</apex:page>

 

 

 

When I click the visualforce tab it keeps running and running (infinite loop....).  How can I get the detail record whenever the page gets loaded?

 

Thank you.

 

 

 

 

Perl is brand new to me and I need to find solution to call Webservice from perl.

Any sample or direction would be very helpful.

 

Thanks in advance

As I understand some of the features in managed package are irreversible. Last time I deployed managed package and later client wanted some of the existing object fields to be modified as external Id. Because of the managed package deployment the feature (external Id -changing) was disabled. For that reason I uninstalled the managed package in the prod, created new development environment, pulled all the components into it through Eclipse ............?!..finally decided not to use the managed package deployment at all to that project.Prod was in Enterprise edition.

 

Now I have to make a similar decision  in professional edition. I am re - researching on best practices. Will you please give some suggestion(s) when/how to use packaged approach & when NOT.

 

Its a kind of urgent.

 

Thanks in advance.

 

 

 

 

 

 

I am getting follwing error while creating Apex Code from WSDL

Apex generation failed

Error: Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType

What could be the reason....?

 

Thanks in advance

I am a little bit confused on 'When to use and when not to use' the Batch Apex. In my understanding I should use it to avoid the governor limits. Every company does business on growing prospective i.e. apex not hitting governor limit at the moment might hit the limit in the future.My apex working fine today might not work after (may be a long after) sometimes. Because of it -while writing apex code I always feel uncomforatble.  Does that mean - is it always safe to use the Batch Apex? I think it should not be true too. Any guidelines ........................

Where can I find document (help) on testing  email send and receive in different environments.

 

Thank you.

I trying to test the controller already in the documentation (

Testing Custom Controllers and Controller Extensionshttp://www.salesforce.com/us/developer/docs/pages/index.htm

 

).
But it doesn't  go beyound 71%. It is not hitting the get methods.

Any idea to achieve the coverage to 100%

 

__________________________________________________________


public class thecontroller {

private String firstName;
private String lastName;
private String company;
private String email;
private String qp;

public thecontroller() {
this.qp = ApexPages.currentPage().getParameters().get('qp');
}

public String getFirstName() {
return this.firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return this.lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getCompany() {
return this.company;
}

public void setCompany(String company) {
this.company = company;
}

public String getEmail() {
return this.email;
}

public void setEmail(String email) {
this.email = email;
}

public PageReference save() {
PageReference p = null;

if (this.qp == null || !'yyyy'.equals(this.qp)) {
p = Page.failure;
p.getParameters().put('error', 'noParam');
} else {
try {
Lead newlead = new Lead(LastName=this.lastName,
FirstName=this.firstName,
Company=this.company,
Email=this.email);
insert newlead;
} catch (Exception e) {
p = Page.failure;
p.getParameters().put('error', 'noInsert');
}
}

if (p == null) {
p = Page.success;
}

p.setRedirect(true);
return p;
}
}

public class thecontrollerTests {

public static testMethod void testMyController() {
PageReference pageRef = Page.success;
Test.setCurrentPage(pageRef);

thecontroller controller = new thecontroller();
String nextPage = controller.save().getUrl();

// Verify that page fails without parameters
System.assertEquals('/apex/failure?error=noParam', nextPage);

// Add parameters to page URL
ApexPages.currentPage().getParameters().put('qp', 'yyyy');

// Instantiate a new controller with all parameters in the page
controller = new thecontroller();
controller.setLastName('lastname');
controller.setFirstName('firstname');
controller.setCompany('acme');
controller.setEmail('firstlast@acme.com');
nextPage = controller.save().getUrl();

// Verify that the success page displays
System.assertEquals('/apex/success', nextPage);
Lead[] leads = [select id, email from lead where Company = 'acme'];
System.assertEquals('firstlast@acme.com', leads[0].email);
}
}
<apex:page controller="thecontroller" tabstyle="lead">
<apex:pageBlock>
<apex:form>
<h1>Test page for adding leads</h1>
<p>This is a test page for adding leads.</p>
<p>First name: <apex:inputText value="{!FirstName}"></apex:inputText></p>
<p>Last name: <apex:inputText value="{!LastName}"></apex:inputText></p>
<p>Company: <apex:inputText value="{!Company}"></apex:inputText></p>
<p>Email address: <apex:inputText value="{!Email}"></apex:inputText></p>
<apex:commandButton action="{!save}" value="Save New Lead"/>
</apex:form>
</apex:pageBlock>
</apex:page>

___________________________________________________________

I created a managed (beta) package which also included some custom fields for standard objects(Account & Contact). I installed the package in QA environment. As I couldn't include the standard page layouts in the package, I tried Eclipse to overwrite the standard page layouts in QA. It doesn't work. But for the standard page layouts that do not use packaged custom field the overwrite process through Eclipse is possible.

 

Any clue...?

I need to get user input as a date value in visualforce page. I can use inputText component for that - in which case user has to manually write the date. But I am looking for a way to give user to pick date from the calander (like in standard salseforce). Can we do it outside of the Salesforce object?

 

Any thoughts ..

I found test methods for XMLdom on

 

http://code.google.com/p/visualforce-components/source/browse/trunk/XmlDom/src/unpackaged/classes

 

How can we test  startHereController class?

I am trying to find out which way is better for prod deployment from dev environment. As I didn't find option to include Approval Processes in managed package, I was looking whether this option is available on Metadata Migration(through Eclipse IDE). I can't access the Approval Processes through Eclipse as well. How can we deploy the Approval Processes?

 

Which way is better for the deployment? Any suggestion(s) would help me to decide whether to go with  Managed Package approach or Metadata Migration approach for production deployment.

 

Thank you.

I am using e-mail template to send e-mails from salesforce but the e-mails are ending up as spammed.

How can I direct them on the valid inbox folder? Has anyone got the similar problem?

 

 

 

How can we throw exception in Apex. I am trying do something like:

 

 

 

 

public class testExpt
{
public void exptTesting(Test_Object__c[] testObjectArray)
{
for (Test_Object__c t: testObjectArray)
{
if(t.test_field__c < 25.00)
{
throw new Exception('This is bad number');
}
}
}
}

 

 

 How can I achieve this in Apex?

 

Hi what should be the date format when using the data loader to upload records from a csv file converted by excel?

Does anyone know how to setup Automatic Case Threading in Salesforce?

 

The documentation appears to be pretty thin

  • September 29, 2009
  • Like
  • 0

Hi,

I want to create Single-Sign-User in Salesforce. But I am not getting that  option in any profile. Please, would you like to suggest me .

 

Thanks,

Sunil kr.

  • September 29, 2009
  • Like
  • 0

I have a "Year Built" field on one of my objects, defined as a 4-digit number. It works fine except that it is always formatted as if it is a number: 2,009 instead of 2009. This is in a managed package, so I cannot delete the field or change the length of the field.

 

How can I format this field so that it appears as a year instead of a number?

 

Thanks,

 

John

  • September 18, 2009
  • Like
  • 0

if(a==1){ ... } else if(a==2){ ... } else if(a==3){ ... }

 

 

 

How to test such a construction in a testmethod ?

Message Edited by Streepie24 on 09-18-2009 06:36 AM
Message Edited by Streepie24 on 09-18-2009 06:37 AM
Message Edited by netbrain on 09-21-2009 11:12 PM

Hello,

 

I think this should be really simple, but it is driving me nuts.

 

I created a custom field called "QuoteContact" which I placed on the opportunity page layout.  It is a lookup field that points to contacts associated with the Account for which the opportunity belongs.   This works fine.   What I am having trouble with is getting this value to show up on an email template (I am using SFDCs simple quote app template). 

 

The weird thing is I have a formula custom field (called email_address_for_quote) that displays the email associated with the quote contact that I can display on the template using the following: 

{!relatedTo.Email_Address_for_Quote__c}

 

I tried using {!relatedTo.QuoteContact__c} in the template, but while the template accepts the code, it does not deliver the expected results.  It displays "003T000000JNdECIA1" instead of the name of the contact.

 

I am guessing there is something I need to do differently to reference a lookup field in template.  Does anyone know?

 

Thankss!

  • September 16, 2009
  • Like
  • 0

I am creating Cases using Email-To-Case. How can I link another incoming email(s) to an existing case?

 

any suggestions?

My requirement is:

 

- create Case using Email-to-Case

- attach the Email attachments (if any) to the newly created Case as Attachments

 

is there a way i can attach the email attachments to the newly created Case in Apex?

 

Thanks in advance.

I am trying to follow the link

 

 Best Practice #6: Querying Large Data Sets states:

 

SOQL queries that return multiple records can only be used if the query results do not exceed 1,000 records, the maximum size limit of a list. If the query results return more than 1,000 records, then a SOQL query for loop must be used instead, since it can process multiple batches of records through the use of internal calls to query and queryMore.

For example, if the results are too large, the syntax below causes a runtime exception:

//A runtime exception is thrown if this query returns 1001 or more records.
Account[] accts = [SELECT id FROM account];

Instead, use a SOQL query for loop as in one of the following examples:

// Use this format for efficiency if you are executing DML statements 
// within the for loop
for (List<Account> accts : [SELECT id, name FROM account
WHERE name LIKE 'Acme']) {
// Your code here
update accts;
}

Let the Force.com platform chunk your large query results into batches of 1000 records by using this syntax where the SOQL query is in the for loop definition, and then handle the individual datasets in the for loop logic.

 

 --------------------------------------------------------------------------------------------------------------------

 

I have a test object with more than 1000 test records on it.  The test trigger is

 

trigger testProfileEffect on ProfileBasedTest__c (before insert)
{
for(List<ProfileBasedTest__c> pbt:[SELECT description__c FROM ProfileBasedTest__c])
{
pbt[0].description__c = 'Hello world!';
update pbt;
}


}

 

As a test, i am trying to update the existing record's description fields while inserting a new record & get exception:

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger Test.testProfileEffect caused an unexpected exception, contact your administrator: Test.testProfileEffect: execution of BeforeInsert caused by: System.Exception: Too many query rows: 1001: Trigger.Test.testProfileEffect: line 3, column 38

 

 

 The exception is because of List limitation but how can I make the Best Practice #6: Querying Large Data Sets workable in this scenerio?

 

Thanks in advance.

 

 

 

I have a VF controller that grabs the "current" record using the getRecord call:

 

        this.controller = stdController;
        this.theQuote = (SFDC_520_Quote__c)stdController.getRecord();

 

Now i'm writing the test class, but when I run it i'm getting an error:

 

System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: SFDC_520_Quote__c.Discount_Type__c

 

However I am referencing this field in my VF page, (see below), so I should have access to it from Apex, right?  (That's how I read the documentation, at least.)  Also note that it works when walking through the app normally - it only fails in the test method.  I even added a hidden input to my VF page to try to resolve this (again, per the documentation) - so it's actually referenced twice.

 

What am I doing wrong?

 

                <apex:inputField value="{!SFDC_520_Quote__c.Discount_Type__c}" />   
 

 Thanks for your time

chris

 

Hello everyone,

 

Everything seems to be so scatter when it comes to getting a simple solution to an when it comes to Apex and SF in general.  Am I the only one feeling this pain?

 

Could someone give me push start on a test script that will insert 201 records into the Opportunity object?  There a many required fields, some of which are drop downs and some are pick lists, not sure if that matters.

Hi,

 

I want to process around 10,000 records using Apex. While querying on object I have limited to 1000 records at a time but I just want to know, "How can I get only those records, which has not been processed/ queried."? So that I can process 1000 records every time in loop.

Dear all,

 

Just a quick question.

 

I have a trigger that calls a series of methods within Apex classes when a contract is activated. Currently, if one of those methods causes an exception, the trigger assumes it is unhandled, even if there is error handling within the apex class. Is there a way of passing the error handling back "up" to the trigger, so that the UI doesn't show an ugly exception page?

 

With thanks,

Andy 

I am writing test coverage code for my organization and i am receiving error of exceeding DML Statements in my Test Class.I have already done test coverage for previous classes successfully but when i want to do test coverage for newly created class.It gives me DML exceeding error.

Is there any solution for this problem as i need to use DML statements in my Test Class to cover more code.

 

Thanks

  • September 08, 2009
  • Like
  • 0

I solved my SOQL Limit problem by looping through the results of one SOQL query.

 

Now I am running against a Script Statement Limit. 

 

How should I go about optimizing my code to avoid this Limit? 

After reading the documentation I did following

1. created sample CSS file named customStyles.css:

 

<style type="text/css">
body { background-image: url("images/SFSummary.gif") }
</style>

 

 2. Zipped up the images folder and customStyles.css together as myStyles.zip

 

 3.  Uploaded myStyles.zip as Static Resources with the name myStyles

 

 

 4. Referenced the stylesheet in visualforce page:

 

<apex:page standardController="Mileage__c" extensions="MileageExtension" tabStyle="Mileage_Custom_View__tab" standardStylesheets="false" >
<apex:stylesheet value="{!URLFOR($Resource.myStyles, 'customStyles.css')}"/>
.......
.......
.......

 

 It does not work. Couldn't figure out .....