• Rutger Gernandt
  • NEWBIE
  • 10 Points
  • Member since 2018
  • De Warme Winkel

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
There is an issue with my HTTP request.salesforce is not allowing me to use PATCH method.
Below are the notification which i get after calling a patch.

System.CalloutException: Invalid HTTP method: PATCH.

when we override the method with patch
req.setHeader('X-HTTP-Method-Override','PATCH');
req.setMethod('POST');
Then i am geeting below notification.
System.HttpResponse[Status=Method Not Allowed, StatusCode=405]
Dear all,

I am mimicing the behavior of the Event object when entering time and dates in a Custom object (because I cannot use the Event object for this use-case). To be able to show these events well in the Salesforce agenda, show them in a proper format in some tables, but also to integrate with external services I have combined the seperate date and time fields (start time + date & end time + date) in a formula date/time field.

While I have a formula for the start date & time that works well, however my formula for the end date & time is just 162 characters too long when compiling... The workaround via processbuilder is not an option, since time field are (not yet) available... 

Does anybody has a suggestion to shorter the check for the daylight saving time? As a guide to the formula's variables: Datum = Start Date, Einddatum = End Date, Tijd = Time, Eindtijd = End Time.

The functionality is: 
- if no end date & no start time is available, use start date as end date and time in such a way that it is displayed as a day length activitity in SF. 
- if no end date is available, but there is an end time: use the start date and the end time. 
- if an end date is available, but there is no end time (day length activity), use enddate and add time
- if an end date and end time is available, use these

The formula: 
IF(ISNULL(Einddatum__c),

  IF(ISNULL(Tijd__c),
 
  IF(Datum__c > (DATE(YEAR(Datum__c),3,31) - MOD(DATE(YEAR(Datum__c),3,31) - DATE(1900,1,7),7)) 
  && Datum__c < DATE(YEAR(Datum__c),10,31) - MOD(DATE(YEAR(Datum__c),10,31) - DATE(1900,1,7),7), 
  DATETIMEVALUE(Datum__c) + ((24-2)/24),  
  DATETIMEVALUE(Datum__c) + ((24-1)/24)),

  IF(Datum__c > (DATE(YEAR(Datum__c),3,31) - MOD(DATE(YEAR(Datum__c),3,31) - DATE(1900,1,7),7)) 
  && Datum__c < DATE(YEAR(Datum__c),10,31) - MOD(DATE(YEAR(Datum__c),10,31) - DATE(1900,1,7),7), 
  DATETIMEVALUE(Datum__c) + ((HOUR(Tijd__c)+1.5-2)/24) + (MINUTE(Tijd__c)/1440), 
  DATETIMEVALUE(Datum__c) + ((HOUR(Tijd__c)+1.5-1)/24) + (MINUTE(Tijd__c)/1440))),

  IF(ISNULL(Eindtijd__c),

  IF(Einddatum__c > (DATE(YEAR(Einddatum__c),3,31) - MOD(DATE(YEAR(Einddatum__c),3,31) - DATE(1900,1,7),7)) 
  && Einddatum__c < DATE(YEAR(Einddatum__c),10,31) - MOD(DATE(YEAR(Einddatum__c),10,31) - DATE(1900,1,7),7), 
  DATETIMEVALUE(Einddatum__c) - (2/24),  
  DATETIMEVALUE(Einddatum__c) - (1/24)),

  IF(Einddatum__c > (DATE(YEAR(Einddatum__c),3,31) - MOD(DATE(YEAR(Einddatum__c),3,31) - DATE(1900,1,7),7)) 
  && Einddatum__c < DATE(YEAR(Einddatum__c),10,31) - MOD(DATE(YEAR(Einddatum__c),10,31) - DATE(1900,1,7),7), 
  DATETIMEVALUE(Einddatum__c) + ((HOUR(Eindtijd__c)-2)/24) + (MINUTE(Eindtijd__c)/1440), 
  DATETIMEVALUE(Einddatum__c) + ((HOUR(Eindtijd__c)-1)/24) + (MINUTE(Eindtijd__c)/1440)))

)

Any help is higly appreciated!