• Christophe Lereverend 4
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I want to have a value from the Group Booking field on Opportunity transferred to Project Attendance when it’s being created from opportunity using the button.
I tried to fullfill the following challenge:
The following formula, meant to return the last day of the current month, has a couple of errors in it:

IF( MONTH( NOW() ) = 12,
  DATE( YEAR( NOW() ), 12, 31 ),
  DATE( YEAR( NOW() ), MONTH( NOW() ) + 1, 1) - 1

Create a new formula with the same label, name, and data type that successfully compiles.
- The formula should be of Date type and on the Case object
- The formula should have the name Last Day of Month and the resulting API name Last_Day_of_Month__c
- The formula should return the last day of the current month

I created a new formular field named "Last Date of Month" for the case object. My formular is as follows which has no syntax errors:
IF(MONTH(Today()) = 12,
  DATE(YEAR(Today()), 12, 31 ),
  DATE(YEAR(Today()), MONTH(Today()) + 1, 1) - 1
)

However, I got the following error message when I try to approve the challenge:

Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You can only set a case as escalated if it is high priority and not closed: [IsEscalated]

Has anyone a clue what I did wrong?

Many thanks in advance.
I currently have a trigger that checks a box when an attachment is added to a custom object called "Contracts__c". I would like to expand this Trigger to only check the box if the actual attatched document includes certain keywords. Is this possible? Here is my current code:

trigger CountAttachment on Attachment (before insert, before delete)
{
if(trigger.isinsert){
List<Contracts__c> co = [select id from Contracts__c where id =: Trigger.New[0].ParentId];
If(co.size()>0)        
{            
co[0].Contract_Attached__c = True;            
update co;        
}
}


if(trigger.isdelete){

List<Contracts__c> co = [select id from Contracts__c where id =: Trigger.old[0].ParentId];        
If(co.size()>0)        
{            
co[0].Contract_Attached__c = false;            
update co;        
}
}
}
I'm new to APEX and I would be grateful if someone could help me with below trigger.
when there is new attachment added to custom Project_Edition__c object I need Venue_Contract_Attached__c to be ticked automatically (and unticked when attachment is deleted)
 
trigger CountAttachments on Project_Edition__c (before insert, before delete)
{
if(trigger.isinsert){
List<Project_Edition__c> co = [select id from Project_Edition__c where id =: Trigger.New[0].ParentId];
If(co.size()>0)         
{             
co[0].Venue_Contract_Attached__c = True;             
update co;         
}
}


if(trigger.isdelete){

List<Project_Edition__c> co = [select id from Project_Edition__c where id =: Trigger.old[0].ParentId];         
If(co.size()>0)         
{             
co[0].Venue_Contract_Attached__c = false;             
update co;         
}
}
}

I'm getting all sorts of errors, last one being "Error: Compile Error: Invalid field ParentId for SObject Project_Edition__c at line 4 column 93"

 
  • February 17, 2015
  • Like
  • 0