• WrogWrog
  • NEWBIE
  • 25 Points
  • Member since 2006

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 9
    Replies
I've just refreshed my sandbox and now cannot edit triggers or classes. I am the admin, I've never had this issue before, in 10 years creating triggers. I've not changed any of the permissions in my profile.
The only thing we have done recently since my last refresh is to change out SF location to https://lanner.my.salesforce.com, but the link to the sandbox is coming out as https://lanner--LannerPlus.cs26.my.salesforce.com/. Could that be part of the problem?

I've been trying to make our mass emails more "personal" by including an intelligent "good morning", "good Afternoon", or "good evening" before the recipient's name. I have a timezone field on the contact to enter the hours before/after GMT, so that by calculating the recipient's current time at the point of sending, I can set the greeting:

if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>24,"Good morning ",if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>17,"Good evening ",if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>12,"Good afternoon ",if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>00,"Good morning ","Good evening "))))

All works fine in theory, and for the most part in practice, but if I send email near midday, I find that some emails go out as "good morning", when it is patently after 12.

 

After some exploration, I find that the TEXT function is at fault. If the value of  NOW()28/09/2009 14:02, then the value of TEXT(NOW())2009-09-28 13:02:18Z. ie the GMT time, rather than the local timeHence the inconsistency in my calculation.

 

I would apply some kind of 1 hour correction, but how do I know when each country switches on/off daylight saving time? My only other alternative is to remember never to send emails near 12:00 or 24:00 (or 13:00 or 01:00) (this may be good practice anyway, but that's not my point!!)

 

I guess Salesforce can come up with a justification for this behaviour, but I would like to suggest it is a bug which should be fixed

 

Unless someone else can help me.......

Until 2 weeks ago I was using Eclipse 3.3. I had a sandbox and a developer org, set up as two projects, and I was able to develop things on either of those, and deploy the changes to the live org. The one things I could no do was change the live org directly - not a problem - I subscribe to the idea of proving in the sandbox forst, then deploying.

 

Unfortunately, I've had to change PCs. I now have Vista (grrr) and as Eclipse 3.4 is now supported, I've installed that. I've then tried to connect with my 3 orgs. Bizarrely, I am completely unable to connect to the sandbox or developer orgs, but can connect to the Live org, AND MAKE DIRECT CHANGES. Seems dangerous to me. When was I given the power to do that?

 

I've tried over and over to connect to the sandbox, which is on server tapp0, and the dev org on server cs1 (neither is on the Test server). I've tried re-generating the tokens, I've tried messing with the SOAP endpoint, but all to no avail.

 

I have spent a lot of time looking through the plethora of documentation and forums about Force.com, the IDE and Eclipse, but cannot find a simple set of instructions on how to connect the IDE to your live environment, then set up your sandbox so that you can deploy from one to another. Can anyone give me these simple instructions? 

 

I would be more grateful than you can imagine! 

I have been using Eclipse for a year or so, creating triggers etc and deploying them with no problem. I also make changes in the sandbox and synch them with my Eclipse environment, again no problem.... until now.

 

No matter what I do, I can't get the "Email" node to pull in the new folders and/or new email I created in the sandbox, either by Synch, or refresh from server etc.

 

I try so hard to make mods in the Sandbox and deploy them properly (it's all to easy to hack straight into the live system), but this time it seems I may actually have to edit the two in parallel.

 

Unless someone out there can help.......

How come all my existing classes suddenly flagged as invalid? 

How come they all work fine even though they are invalid? 

How come all I need to do is edit them and save them to make them "valid"? (it only took 10 minutes of tedious repetitive clicking of edit and save buttons, and as a Salesforce Admin, I have nothing better to do with my time.)

 

How come I am not very reassured? 

 

Prepared to accept I missed some announcement, but surely there is a better way of implementing new features like this..... 

Can anyone confirm whether this is a bug or a misunderstanding.

 

I cannot create workflow rules on the Attachment or Note objects to notify that they have been added/changed. Therefore I have created a trigger to update a field on the parent custom object, so that the field can be used for the workflow rule. My trigger for notes works fine, but the trigger for attachments (almost identical to the Notes trigger) only fires for undates, not for inserts, whether these are before or after insert. I've looked in the debug log and the trigger is not called at all if an attachment is inserted.


I think this must be a bug. Can't think of any logical reason why Attachments would behave differently to Notes. 

 

My code looks like this:

 

trigger Attachment_BeforeInsertUpdate on Attachment (before insert, before update) {	Attachment[] att = Trigger.new;	for (Attachment item : att ){				//Ignore if no PCR linked to CSR			PCR__c[] pcrs = [select Id, attachment_change__c from PCR__c where Id = :item.parentid];		System.assert(pcrs.size() > 0);		for (PCR__c pcr : pcrs) {				pcr.attachment_change__c = System.now();			update pcr;		}	}}

 Any thoughts anyone?

 

Roger England 

Just when I thought I had got my head round Eclipse, editing metadata and deploying objects, tabs etc from sandbox to live environment, I'm stopped dead in my tracks.
 
If I click on most of the folders under the "src" node in Eclipse, I can create a "new...", except for a few exceptions such as Layouts and emails. However, at least I can see the layouts on my sandbox, waiting to be deployed to Live.
 
The complete exception is my reports folder, which only lists (and synchronizes with) the live system. I cannot see any of the reports I've created in the sandbox, nor the new folders there. What I CAN see is the stuff on Live. Isn't this back to front? I'm currently faced with deploying the hard way by replication of the work from sandbox to live - ouch.
 
Any suggestions as to how I can get Reports folder in src to look in the right place?
 
Thanks
 
Roger
I am slavishly trying to follow the many code snippets in cookbooks etc, to try an achieve something simple. I wish to generate a record in my custom object "Shipment" which is linked to a standard object Opportunity. Most examples in the documentation are far more complex than this, but I can't get it to work at all.
 
The button is on the Opportunity detail form (is that the wrong place?) and should pass the opportunity record into my apex class to insert the record in Shipment__c.
 
All I get is an error message :
A problem with the OnClick JavaScript for this button or link was encountered:
Object doesn't support this property or method
 
I've had various other error messages whilst creeping forward with versions of this one, some of them seem to "get stuck" with the a given error message appearing, even after I have modified the code to not actually do anything. Is this a bug?
 
Can anyone help me? You might guess I'm new to this, but I'm not stupid, and I've mimicked code supplied in the Apex code guide (haven't I?). I'd be very grateful.
 
Roger
 
Code for button:
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}

var opportunity= sforce.sObject("Opportunity");
var id sforce.apex.execute("Opportunity_Generate_Shipment","makeShip",{opp:opportunity});
 
code for class:

global class Opportunity_Generate_Shipment {
  WebService static Id makeShip(Opportunity opp) {
    try {
      Shipment__c ship = new Shipment__c ();
      ship.name = 'name';//opp.name, 
      ship.Opportunity__c = opp.id;
      insert ship;
      return ship.id;
    }
    finally{
    }
  }
}

 
(the smiley that appears in the code is actually a colon. Why would I ever want to include a **** smiley in any message?)


Message Edited by WrogWrog on 12-12-2008 07:18 AM
Still a newbie to Apex (in fact, a newbie to "proper" code writing at all). Can't see a simple answer to my question, so here goes with a discussion topic.
 
We would like to set the status of any "new" (unread) emails attached to a case to "read" at the point of closing a case. Can I actually do this?
 
My current trigger is as below. If I understand the log, it fails (with an unknown error) at the line highlighted in red. Is this because I can't do that, or becuase I'm doing it wrong?
 
I've been told I should be able to change the status of an email remotely, but I could imagine this might not be "good practice".
 
Roger England
 
Code:
trigger Case_CloseEmailComment_update on Case (before update) {

 Case[] cs = Trigger.new;
 
 if (cs[0].Status == 'Closed' ) {
  ID csId = cs[0].Id; 
  
  if (cs.size() > 0){
   cs[0].HasCommentsUnreadByOwner = false;
 
   EmailMessage[] ems = [select Id, Status from EmailMessage where (ParentId = :csId)]; 
   if (ems.size() > 0){
    for (EmailMessage em: ems){
     if (em.Status == '0'){
      em.Status = '1'; 
      update em;
     }
    }
   }
  }
 }
}

I've been trying to make our mass emails more "personal" by including an intelligent "good morning", "good Afternoon", or "good evening" before the recipient's name. I have a timezone field on the contact to enter the hours before/after GMT, so that by calculating the recipient's current time at the point of sending, I can set the greeting:

if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>24,"Good morning ",if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>17,"Good evening ",if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>12,"Good afternoon ",if(value(MID (TEXT (now()), 12, 2))+Time_Zone__c>00,"Good morning ","Good evening "))))

All works fine in theory, and for the most part in practice, but if I send email near midday, I find that some emails go out as "good morning", when it is patently after 12.

 

After some exploration, I find that the TEXT function is at fault. If the value of  NOW()28/09/2009 14:02, then the value of TEXT(NOW())2009-09-28 13:02:18Z. ie the GMT time, rather than the local timeHence the inconsistency in my calculation.

 

I would apply some kind of 1 hour correction, but how do I know when each country switches on/off daylight saving time? My only other alternative is to remember never to send emails near 12:00 or 24:00 (or 13:00 or 01:00) (this may be good practice anyway, but that's not my point!!)

 

I guess Salesforce can come up with a justification for this behaviour, but I would like to suggest it is a bug which should be fixed

 

Unless someone else can help me.......

Until 2 weeks ago I was using Eclipse 3.3. I had a sandbox and a developer org, set up as two projects, and I was able to develop things on either of those, and deploy the changes to the live org. The one things I could no do was change the live org directly - not a problem - I subscribe to the idea of proving in the sandbox forst, then deploying.

 

Unfortunately, I've had to change PCs. I now have Vista (grrr) and as Eclipse 3.4 is now supported, I've installed that. I've then tried to connect with my 3 orgs. Bizarrely, I am completely unable to connect to the sandbox or developer orgs, but can connect to the Live org, AND MAKE DIRECT CHANGES. Seems dangerous to me. When was I given the power to do that?

 

I've tried over and over to connect to the sandbox, which is on server tapp0, and the dev org on server cs1 (neither is on the Test server). I've tried re-generating the tokens, I've tried messing with the SOAP endpoint, but all to no avail.

 

I have spent a lot of time looking through the plethora of documentation and forums about Force.com, the IDE and Eclipse, but cannot find a simple set of instructions on how to connect the IDE to your live environment, then set up your sandbox so that you can deploy from one to another. Can anyone give me these simple instructions? 

 

I would be more grateful than you can imagine! 

I have been using Eclipse for a year or so, creating triggers etc and deploying them with no problem. I also make changes in the sandbox and synch them with my Eclipse environment, again no problem.... until now.

 

No matter what I do, I can't get the "Email" node to pull in the new folders and/or new email I created in the sandbox, either by Synch, or refresh from server etc.

 

I try so hard to make mods in the Sandbox and deploy them properly (it's all to easy to hack straight into the live system), but this time it seems I may actually have to edit the two in parallel.

 

Unless someone out there can help.......

Can anyone confirm whether this is a bug or a misunderstanding.

 

I cannot create workflow rules on the Attachment or Note objects to notify that they have been added/changed. Therefore I have created a trigger to update a field on the parent custom object, so that the field can be used for the workflow rule. My trigger for notes works fine, but the trigger for attachments (almost identical to the Notes trigger) only fires for undates, not for inserts, whether these are before or after insert. I've looked in the debug log and the trigger is not called at all if an attachment is inserted.


I think this must be a bug. Can't think of any logical reason why Attachments would behave differently to Notes. 

 

My code looks like this:

 

trigger Attachment_BeforeInsertUpdate on Attachment (before insert, before update) {	Attachment[] att = Trigger.new;	for (Attachment item : att ){				//Ignore if no PCR linked to CSR			PCR__c[] pcrs = [select Id, attachment_change__c from PCR__c where Id = :item.parentid];		System.assert(pcrs.size() > 0);		for (PCR__c pcr : pcrs) {				pcr.attachment_change__c = System.now();			update pcr;		}	}}

 Any thoughts anyone?

 

Roger England 

Still a newbie to Apex (in fact, a newbie to "proper" code writing at all). Can't see a simple answer to my question, so here goes with a discussion topic.
 
We would like to set the status of any "new" (unread) emails attached to a case to "read" at the point of closing a case. Can I actually do this?
 
My current trigger is as below. If I understand the log, it fails (with an unknown error) at the line highlighted in red. Is this because I can't do that, or becuase I'm doing it wrong?
 
I've been told I should be able to change the status of an email remotely, but I could imagine this might not be "good practice".
 
Roger England
 
Code:
trigger Case_CloseEmailComment_update on Case (before update) {

 Case[] cs = Trigger.new;
 
 if (cs[0].Status == 'Closed' ) {
  ID csId = cs[0].Id; 
  
  if (cs.size() > 0){
   cs[0].HasCommentsUnreadByOwner = false;
 
   EmailMessage[] ems = [select Id, Status from EmailMessage where (ParentId = :csId)]; 
   if (ems.size() > 0){
    for (EmailMessage em: ems){
     if (em.Status == '0'){
      em.Status = '1'; 
      update em;
     }
    }
   }
  }
 }
}

I have a problem: we should fire a trigger after a file was attached to a custom object. Unfortunately the “after insert” and the “before insert” event on the Attachment object doesn’t get fired (but the after delete event does but we don't need that).

Does anybody has an  idea why? It can't be the code, it's just debugoutput. Or any workaroung?


  • April 17, 2008
  • Like
  • 0
I have an account with 8000+ contacts.  When the account is updated, a trigger fired and call a class method to update these 8000+ contacts.  I'm running into the 'Too many DML rows' problem.  Is it possible to do something like this with apex trigger?  Thank you.
Hi,
     I am new to the AppXchange APIs so this may sound very trivial but I couldnt figure out a lot from the documents. I am enhancing the email2case agent and I got it to work with the partner WSDL for version 7.0. The next step is I want to handle email messages that are a followup to a case by adding it to an existing case as a task rather than opening up a new case which the email2case agent does by default. Is there a way to achieve such functionality through either the enterprise or partner wsdl and what is the best way to schieve it. We will be following a particular format so by parsing the email subject we can categorize it as either an update or a creation of a new case. The partnerWSDL has just one operation(handleEmailMessae) for handling email messages which does not meet this requirement.
 
Thanks!
  • April 03, 2006
  • Like
  • 0