• Ben Falter
  • NEWBIE
  • 5 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hi ! 

I tried to create tasks with the REST API and update the "Name" field with a contact.

It worked well when I used "WhoId" : "00000WSSFSEFF",

but when I tried to use an external ID I got this error message : 

[{"message":"Cannot deserialize instance of reference from START_OBJECT value { or request may be missing a required field at [line:7, column:21]","errorCode":"JSON_PARSER_ERROR"}]
 

URL : https://domain.my.salesforce.com/services/data/v20.0/sobjects/task

BODY :
{ "OwnerId": "0000XXX0000",
"Type": "Email",
"Subject": "Upsell",
"Status": "Not Started",
"Priority":"Normale",
"WhoId": { "ExternalId__c" : 4051 }
}

I also tried "Who": { "ExternalId__c" : 4051 }, and lots of other syntax but nothing worked.

Can you help me to solve this, please ? 

I have an APEX Trigger that runs when a Task is created/updated, so it can update the related Case. 

 

Somehow, the trigger is causing the Case Assignment Rules to re-fire, but I don't know what.  Any thoughts?

 

 

 

trigger caseLastActivityDate on Task (after insert, after update) { Map<String, Task> tMap = new Map<String, Task>(); for (Task t : System.Trigger.new) { String whatId = t.WhatId; System.debug('whatId is ' + whatId); if(whatId <> null && whatId.startsWith('500') == true) { Case c = [select Id from Case where Id = :whatId]; if(c.Id <> null) { c.Last_Activity_Date__c = t.LastModifiedDate; update c; } } } }