• Seth Payne
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi,
I am trying to create a query that shows me all the contact owner and account owner are different.

Here is what I have now:
 
Select Id, AccountId, OwnerID, Acccount.OwnerId 
    FROM Contact 
    WHERE OwnerId != Account.OwnerID


Here is the error i am receving in Query Editor:
Unknown error parsing query

I am assuming this is because one of them is polymorphic and can be user or queue.  Any thoughts are a work around for this query?

 
Trying to create trigger to create a task when a date is filled in.  Here is what i have so far and getting the error above.

 
trigger CreateTaskonAnnualReport on Annual_Report__c (after update) {
    
    List<Task> newTasks = new List<Task>();
        for (Annual_Report__c ar : Trigger.isupdate()){
            //Creating Task to Matt Sutherland when Certificate Date is updated from null to any value, and he was the initial submitter
            if (Trigger.old[ar].Certificate_Date__c != Trigger.new[ar].Certificate_Date__c
Thoughts on why I am getting this error or any ideas to improve?

Thanks,
Seth

The error above is the used when i have this code:

 trigger HD5HashGeneratorContact1 on Contact (before insert, before update) {
   
    for (contact c : Trigger.new){
        if (c.HD5Hash__c == null) {
            c.HD5Hash__c = EncodingUtil.convertToHex(Crypto.generateDigest('MD5', Blob.valueOf(c.id)));          
   
        break;
        }
    }

When I change the code to after insert this is the error i get:

execution of AfterInsert caused by: System.FinalException: Record is read-only:


trigger HD5HashGeneratorContact1 on Contact (after insert, before update) {
   
    for (contact c : Trigger.new){
        if (c.HD5Hash__c == null) {
            c.HD5Hash__c = EncodingUtil.convertToHex(Crypto.generateDigest('MD5', Blob.valueOf(c.id)));          
   
        break;
        }
    }
}
}

What do i need to do to be able to generate a MD5 Hash out of the contact ID?

Thanks,
Seth
Trying to create trigger to create a task when a date is filled in.  Here is what i have so far and getting the error above.

 
trigger CreateTaskonAnnualReport on Annual_Report__c (after update) {
    
    List<Task> newTasks = new List<Task>();
        for (Annual_Report__c ar : Trigger.isupdate()){
            //Creating Task to Matt Sutherland when Certificate Date is updated from null to any value, and he was the initial submitter
            if (Trigger.old[ar].Certificate_Date__c != Trigger.new[ar].Certificate_Date__c
Thoughts on why I am getting this error or any ideas to improve?

Thanks,
Seth

The error above is the used when i have this code:

 trigger HD5HashGeneratorContact1 on Contact (before insert, before update) {
   
    for (contact c : Trigger.new){
        if (c.HD5Hash__c == null) {
            c.HD5Hash__c = EncodingUtil.convertToHex(Crypto.generateDigest('MD5', Blob.valueOf(c.id)));          
   
        break;
        }
    }

When I change the code to after insert this is the error i get:

execution of AfterInsert caused by: System.FinalException: Record is read-only:


trigger HD5HashGeneratorContact1 on Contact (after insert, before update) {
   
    for (contact c : Trigger.new){
        if (c.HD5Hash__c == null) {
            c.HD5Hash__c = EncodingUtil.convertToHex(Crypto.generateDigest('MD5', Blob.valueOf(c.id)));          
   
        break;
        }
    }
}
}

What do i need to do to be able to generate a MD5 Hash out of the contact ID?

Thanks,
Seth