• RonGong
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hey SF Community,

I'm trying to update a workflowalert through the tooling api and when I try to generate the json I am getting the following error with the recipient "type" field set to "user" and the "senderType" field set to "CurrentUser".  I've noticed that these are both enumeration fields, do they have to be generated differently?

Here is the error I can receiving:
[{"message":"Cannot deserialize instance of complexvalue from VALUE_STRING value user at [line:7, column:37]","errorCode":"JSON_PARSER_ERROR"}]

Here is the code I used to generate the json:
JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartObject();
gen.writeFieldName('Metadata');
gen.writeStartObject();
gen.writeStringField('description', 'testing');
gen.writeStringField('template', 'EmailFolder/CustomerPortalChangePwdEmail');
gen.writeStringField('senderType', 'CurrentUser');
gen.writeFieldName('recipients');
gen.writeStartArray();
gen.writeStartObject();
gen.writeNullField('field');
gen.writeStringField('recipient', 'ron@rondev.com');
gen.writeStringField('type', 'user');
gen.writeEndObject();
gen.writeEndArray();
gen.writeEndObject();
gen.writeEndObject();

Any help is appreciated.  Thanks!

Hi Community,

 

who can provide a good and effective way to remove duplicates from a List of sObjects?

 

Of course without another SOQL ;)

 

Cheers,

//Hannes