You need to sign in to do that
Don't have an account?

Deploying Apex using Force IDE or 'ant deploy'
I'm trying to deploy Apex code for the first time and I've run into an issue.
I've tried using both the Force.com IDE and Apache Ant/CMD line methods for deployment and I can't deploy to a live production environment.
When I run "ant deploy" with my connection info setup for a developer account, the build is successful. When I change the connection info to represent a live environment, I get the following error:
I've tried using both the Force.com IDE and Apache Ant/CMD line methods for deployment and I can't deploy to a live production environment.
When I run "ant deploy" with my connection info setup for a developer account, the build is successful. When I change the connection info to represent a live environment, I get the following error:
Code:
BUILD FAILED C:\Documents and Settings\cloretz\Desktop\salesforce_ant\sample\build.xml:12: Fa iled: testcase in class 'compileAndTest' method 't1' failure:System.DmlException: Inse rt failed. First exception on row 0; first error: INVALID_FIELD_FOR_INSERT_UPDAT E, Account: bad field names on insert/update call: Name: [Name] stack-trace: Class.compileAndTest.t1: line 7, column 9 Code coverage error on phoneSetter: Test coverage of selected Apex Trigger is 0% , at least 1% test coverage is required Code coverage error: Test coverage of selected Apex Class and Trigger is 25%, at least 75% test coverage is required
- 75% of your Apex scripts are covered by unit tests, and all of those test complete
successfully.
- Every trigger has some test coverage.
- All classes and triggers compile successfully.
It looks like your Apex code only has test coverage of 25%, and that at least one of your unit tests is failing.Note that when deploying to a production organization, every unit test in your organization namespace is executed.
See the Apex Developer Guide under Getting Started > Introducing Apex > What is the Apex Development Process? > Deploying Apex to a Salesforce Production Organization.
I think on your live environment, person account is setup and it is default record type of account. Hence it throwing exception for setting name field. Check that. Because Name field is not available for the person account.
And if this is the case then till deployment, change your account default record type to business account.
Regards
V.R.
Thanks for the tip.
The error is still a test coverage problem:
Here is my build.xml
The following is my apex code, which is from Mass Notes in the Apex Cookbook.
I don't see any Apex unit tests defined in the code you've posted, which is why the Ant deployment is reporting 0% code coverage. You need to create TestMethods that exercise at least 75% of your lines of code before you can deploy to a production environment.
Jon
Everything makes sense now. I've been trying to piece the process together from the force.com cookbook and everything works without a hitch in development. I'll get on those unit tests.
Cheers.
This allowed me to deploy but now I'm getting this error:
The s-control that calls the webservice and the apex code are from the Apex cookbook I believe.
The code works and inserts multiple notes from the list view, however that above error is displayed before the script prompt in IE only and if you hit the cancel button in both IE and Firefox.]
Unfortunately, our org uses IE alot.
Thanks for all the help!
Message Edited by Colin Loretz on 01-31-2008 10:45 AM
A very simple solution would be:
You will want to refine the behavior further--such as applying a trim() to the response to remove whitespaces before checking if it's an empty string. One caveat--I'm not sure if "return" will work here, so you may need to enclose the subsequent code in big if statements that ensure noteTitle, and then noteBody, are not null.
But this code will at least protect you against the two most likely user actions that would result in an error.