• wilbur07
  • NEWBIE
  • 5 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 21
    Replies
I have a scheduled task that uses dataloader 12.0 that has been running for a while.
 
Today I get an error saying my password expired but that is not the case.  I tried manually to login using dataloader and it will not let me login.
 
Is there maintenance being done in production at salesforce or some other issue I should be aware of?
 
TIA
 
James
I'm trying to log in to one of the sandboxes i'm working on and i get a "server is temporarily unable to process your request" message.
 
Is the test.salesforce.com site down?
 
When will it be back up?
 
James
This line gives me an error in my trigger:

for (Case a: [select Id,CreatedDate,Total_Minutes_Active_Clock__c from Case]) {

because i have more than 1000 cases and the limit on query rows is 1000 in a trigger.

What is the standard method of getting around this limit for apex triggers?

James
I keep getting compile errors on this piece of code which calculates time spent on support contracts:
 
Case[] allcases = [select Id, CreatedDate from Case];
Integer i=0;
Integer x=0;
Integer weekstime = 7*24*60*60*1000;
Integer daystime = 24*60*60*1000;
Integer hourstime = 60*60*1000;
Integer minutestime = 60000;
List<Contact> tbu = new Contact[ 0];
for (Case a: allcases) {
 Integer calctime=0;
 Integer numweeks=0;
 Integer remainder=0;
 x = System.now() - a.CreatedDate;
 numweeks = Math.floor(x/weekstime);
 calctime += 40*hourstime*numweeks;
 remainder = Math.mod(x,weekstime);
 Datetime finishweek = a.CreatedDate.addSeconds(remainder/1000);
 Datetime temptime = a.CreatedDate;
 while(temptime<finishweek) {
  Integer temptimehour = temptime.hour;
  if(temptime.format('dddd')=='Friday' && temptimehour>=17) temptime = temptime.addDays(2);
  else if(temptime.format('dddd')=='Saturday' && temptimehour<9) temptime = temptime.addDays(2);
  else if(temptime.format('dddd')=='Sunday' && temptimehour<9) temptime = temptime.addDays(1);
  else if(temptime.format('dddd')=='Saturday' && temptimehour>=9) temptime = temptime.addDays(1);
  else if(temptime.format('dddd')=='Sunday' && temptimehour>=9) temptime = temptime.addHours(8);
  else if(temptimehour< 8) temptime = temptime.addHours(1);
  else if(temptimehour>=17) temptime = temptime.addHours(8);
  else if(temptimehour>=8 && temptimehour<17) {
    if(temptimehour==8) temptime = temptime.addMinutes(1);
    else {
     if(temptimehour<17) {
      calctime += hourstime;
      temptime = temptime.addHours(1);
     }
     else {
      calctime += minutestime;
      temptime = temptime.addMinutes(1);
     }
    }
   }
 }
 a.SLA_Elapsed_Time__c = calctime;
 tbu.add(a);
}
update tbu;
 
I can't get past a couple of errors.  On the lines:
Datetime temptime = a.CreatedDate;
Integer temptimehour = temptime.hour;
 
I get an error that says "Initial term of field expression must be a concrete SObject: Datetime"
 
I thought I just declared the object to be Datetime???????????????
 
The second error I get is on the line:
 
x = System.Now() - a.CreatedDate;
 
It says "Date/time arithmetic expressions must use Integer and Double arguments"
 
I thought each datetime represented the amount of milliseconds since January 1 1970 or something like that, and were double types of variables themselves?????????
 
Can someone help me with these errors?
 
James
 
How do you use Force.com IDE eclipse to write anonymous blocks of code? Can someone give me step by step instructions on how to open a new box of text [it's not a class, or an apex component, what is it?] that you can execute anonymously in eclipse.

Thanks.
I have a csv file that Data Loader would handle nicely except that one of the columns in the CSV is called salesperson1 and it has values that are names.  I would like to map this value into Contact.Name but you can't do that in Data Loader.

What I need is to go into sfdc and find out the contact id's that match the names in my csv file and then use that to populate the contact field when I migrate the data from csv to salesforce.

What is the best way to do this?  I'm thinking Talend but I haven't found an easy solution there either.

James
I have 2 questions:

1. I have address1, address2, and address3 fields in my csv that are supposed to go to Billing Street field in sfdc. Do I have to merge those three fields into one in my csv before using data loader?

2. I have a field called salesperson which is supposed to map to Account Owner on account object, but the field is OwnerId, and I don't have the Id of the person named in salesperson. how do I obtain the Contact Id of the person in question so I can put in the csv instead of the person's name?

Thanks for any help.

James
I think I found a nasty bug in salesforce.

I created AssetHistory object which is supposed to be a replica of CaseHistory object only tracks Asset changes.
When creating the trigger to make the system work I could not assign any values to AssetHistory__c.Asset__r!!!!

Unlike Contact.AccountID which is used to assign a parent Account ID to a contact, I could not assign a value to AssetHistory.AssetID which is an invalid field or any other iteration of the same, Asset__r.Id is not writeable, Asset.ID does
not work, Asset__r= [select id from Asset where id = 'somevalidAssetID'] does not work!!!!!!

None of the Asset references to ID or the sObject Asset instances are stored when I assign Asset__r = <some valid Asset> and then insert the new AssetHistory__c record!!!!!

This has got to be a bug!

Any help of course would be appreciated.

James
I have a trigger on Asset that writes AssetHistory much like CaseHistory tracks changes in Cases.

I am having trouble assigning a value to the parent field Asset__r.  When I assign Asset__r.Id to a trigger value it says that field is not writeable.  If I assign Asset object from trigger (say Asset a : trigger new) Asset__r=a; then nothing gets written to that field on the trigger event, and the asset history item does not show on related list under the Asset. 

Please tell me a way to assign the correct Asset value, whether Id or Name or what, to the parent field AssetHistory__c.Asset__r field and I will be forever in debt to you.

James
I have this code which gives an error when I try to compile my trigger:

for (Asset a : Trigger.new) {
    if (Trigger.isInsert) {
        AssetHistory__c nli0 = new AssetHistory__c();
        nli0.Name='Created';
        nli0.Asset__r.Id=a.Id;
        insert nli0;
    }
    else {

the error is Error: Compile Error: Field is not writeable: Asset__r.Id at line 8 column 9

I tried this replacement which compiles but does not assign any value to the parent field Asset__r when the trigger executes.

nli0.Asset__r=a;

and these lines all give cannot write errors, or field not in AssetHistory__c object:

nli0.Asset__rId = a.Id;
nli0.AssetId = a.Id;

My question is, how do I assign a parent Asset to my AssetHistory__c objects?

Any help is appreciated.
There's a lead conversion button that converts a lead into a contact with a new account.

I need to propagate field values from the lead (which is deleted or made inactive) to the account and to the newly created contact.

Where should I write the trigger, and how do I access the lead object if it is deleted?

Is it a trigger on Leads after delete?

Or a trigger on Accounts before insert?  How do I reference the Lead in this case?

Do I need to write another trigger on Contact before insert as well?

Thanks for any help.

James
I have a trigger that includes custom fields.  When I try to deploy the package to production it can't because of the duplicate custom fields that are already there.
 
I can't create a package without the included custom fields, and I can't simply delete those custom fields from the production environment.
 
How am I supposed to deploy my new trigger to production?
 
Any help is appreciated.
I'm at a loss how i can get code coverage with this trigger:
 
trigger forcemeetingEventtrigger on Event(before insert) {

  Event[] evt= Trigger.new;

   Forcemeeting.addforcemeeting(evt);

}
 
Can somebody suggest something at this point that would be useful?  I've read all the docs and examples on unit testing.
I'm having trouble deploying to a regular organization (not developer or sandbox).
 
Here is the apex code:
 
trigger AutoPopulatePricebookEntry on Product2 (after insert) {
 
 sObject s = [select ID from Pricebook2 where IsStandard = TRUE];
 
 for (Product2 newProduct: Trigger.new) {
  
  PricebookEntry z = new PricebookEntry(Pricebook2Id=s.ID, Product2Id=newProduct.ID, UnitPrice=0.00, IsActive=TRUE, UseStandardPrice=FALSE);
  insert z;
  
 }
}
 
Here is my testcode that I ran all tests on and succeeded:
 
public class myClass {
  static testMethod void testInsertLine() {
   Product2 p = new product2(name='x');
   
   try{
    insert p;
                }
          catch (DmlException e) {
            System.debug(e.getMessage());
                }
   
   System.assertEquals(0.00, [select UnitPrice from PricebookEntry
                               where product2id = :p.id].UnitPrice);
  }
 }
 
When I try to deploy the Eclipse message is that all 4 lines of my code are uncovered.
 
HEEEELLLLLPPPPP!!!!!  Several hours of frustration lead me to beg someone's knowledge and wisdom.  Perhaps some sample code showing me how to cover each line in my trigger?  Thanks in advance!
 
James
on an s-control that will process a list of products associated with an opportunity, how do I reference the opportunityID of the opportunity chosen to display the s-control?
 
is it var oppid = "{!Opportunity_ID}"
 
???
 
This doesn't seem to work.
How do you modify [add] related lists?
Hi!  I'm new to salesforce, and I have a question or call for an example to help get me started.
 
I need to write an Apex trigger that captures when a new product is created and then writes in an entry in the pricebook of 0.00 for that product.
 
Any help would be appreciated.

Hi all,

I'm a newbie here, though a fairly experienced programmer.
My company is planning to develop a force.com composite application that includes
custom tabs, custom objects with related 'business logic' which makes
outbound webservice calls, and triggers on multiple objects (e.g,
Opportunity, Case, as well as our custom objects). The technical stuff looks
straight forward - APEX seems be a really well-put-together platform, but
there are still some gaps in my understanding on some of the non-technical stuff (packaging,
the fee model, etc.). If there are docs that describe these, I'd really appreciate pointers to them.

Here goes. Some of the questions may be pretty basic, so pardon my ignorance.

1. Once I've packaged my app and registered it on AppExchange, when an admin
user installs the app for everyone in an organization, will the install
process also install the triggers for each user?
2. If my application requires triggers to be created selectively for certain
objects (e.g., if user has a certain report, then create a trigger for
object type X else create trigger for object type Y), or for all objects
(i.e., install triggers for all objects in all applications that the current
user has), is there a way my app can get control during install and create
triggers programmatically?
3. From my database experiences, I know that triggers make things slow, so
are there best practices for using triggers, especially for multiple
objects?
4. Once I develop the app, how long can it remain in force.com (using up
database space, etc.) before it needs to be registered with AppExchange (or
deleted)?
5. The registration process includes certification by the force.com folks to
make sure it is kosher and to attach a license manager to it to track its
installations.  With the Winter 08 release, I believe it is also possible to
upload an app to AppExchange but not register it (the app will remain
unlisted and won't show up in AppExchange, but I can email the url to
individuals for them to try it out). What are the pros and cons of both
approaches? In the latter case, does it simply mean I won't be notified when
the app is installed? Are there other drawbacks? Are there fee differences
between the two (I mean the subscription fee, not the certification fee)?

Thanks in advance.

How does one go about segregating value add in Apex/package based environment?

Here is my issue:

Let's say i define a custom object called Foo with attributes A,B,C,D.along with related business logic etc...

I package this as a "Foo package"  and sell it as Foo Application.

I now want to build another application with object Zoo with it's own attributes.

However, Foo is related to Zoo and actually has a lookup field to Zoo!  The moment, I add "Zoo" as a lookup field, to Foo,  system automatically includes Zoo in the "Foo Package". Once Zoo is included, all the objects get pulled it and the whole thing becomes a mess - there is no way to disallow access to users once Zoo is installed.

Are there any suggestions/workarounds?





Hi all:
   I am using an Integration Tool to upload data into the products2 and pricebookEntry table... Now, I can load data into the product2 table no issues there. But when I try to load the pricebookentry to link back to product2Is and pricebook2Id.. the issue I have having is "[SFDC] No standard price defined for this product    [SFDC] STANDARD_PRICE_NOT_DEFINED"
Ok Now I know that standard price is the default unit price if you go through the excel connector in a Product table...
But how do you fill it through an API when it is not part of the product2 table???
Any help ... Please Advise...
Thanks
Shan
I think I found a nasty bug in salesforce.

I created AssetHistory object which is supposed to be a replica of CaseHistory object only tracks Asset changes.
When creating the trigger to make the system work I could not assign any values to AssetHistory__c.Asset__r!!!!

Unlike Contact.AccountID which is used to assign a parent Account ID to a contact, I could not assign a value to AssetHistory.AssetID which is an invalid field or any other iteration of the same, Asset__r.Id is not writeable, Asset.ID does
not work, Asset__r= [select id from Asset where id = 'somevalidAssetID'] does not work!!!!!!

None of the Asset references to ID or the sObject Asset instances are stored when I assign Asset__r = <some valid Asset> and then insert the new AssetHistory__c record!!!!!

This has got to be a bug!

Any help of course would be appreciated.

James
I have a trigger on Asset that writes AssetHistory much like CaseHistory tracks changes in Cases.

I am having trouble assigning a value to the parent field Asset__r.  When I assign Asset__r.Id to a trigger value it says that field is not writeable.  If I assign Asset object from trigger (say Asset a : trigger new) Asset__r=a; then nothing gets written to that field on the trigger event, and the asset history item does not show on related list under the Asset. 

Please tell me a way to assign the correct Asset value, whether Id or Name or what, to the parent field AssetHistory__c.Asset__r field and I will be forever in debt to you.

James
I have this code which gives an error when I try to compile my trigger:

for (Asset a : Trigger.new) {
    if (Trigger.isInsert) {
        AssetHistory__c nli0 = new AssetHistory__c();
        nli0.Name='Created';
        nli0.Asset__r.Id=a.Id;
        insert nli0;
    }
    else {

the error is Error: Compile Error: Field is not writeable: Asset__r.Id at line 8 column 9

I tried this replacement which compiles but does not assign any value to the parent field Asset__r when the trigger executes.

nli0.Asset__r=a;

and these lines all give cannot write errors, or field not in AssetHistory__c object:

nli0.Asset__rId = a.Id;
nli0.AssetId = a.Id;

My question is, how do I assign a parent Asset to my AssetHistory__c objects?

Any help is appreciated.
I'm having trouble deploying to a regular organization (not developer or sandbox).
 
Here is the apex code:
 
trigger AutoPopulatePricebookEntry on Product2 (after insert) {
 
 sObject s = [select ID from Pricebook2 where IsStandard = TRUE];
 
 for (Product2 newProduct: Trigger.new) {
  
  PricebookEntry z = new PricebookEntry(Pricebook2Id=s.ID, Product2Id=newProduct.ID, UnitPrice=0.00, IsActive=TRUE, UseStandardPrice=FALSE);
  insert z;
  
 }
}
 
Here is my testcode that I ran all tests on and succeeded:
 
public class myClass {
  static testMethod void testInsertLine() {
   Product2 p = new product2(name='x');
   
   try{
    insert p;
                }
          catch (DmlException e) {
            System.debug(e.getMessage());
                }
   
   System.assertEquals(0.00, [select UnitPrice from PricebookEntry
                               where product2id = :p.id].UnitPrice);
  }
 }
 
When I try to deploy the Eclipse message is that all 4 lines of my code are uncovered.
 
HEEEELLLLLPPPPP!!!!!  Several hours of frustration lead me to beg someone's knowledge and wisdom.  Perhaps some sample code showing me how to cover each line in my trigger?  Thanks in advance!
 
James
How do you modify [add] related lists?
Hi!  I'm new to salesforce, and I have a question or call for an example to help get me started.
 
I need to write an Apex trigger that captures when a new product is created and then writes in an entry in the pricebook of 0.00 for that product.
 
Any help would be appreciated.