• denis banks
  • NEWBIE
  • 0 Points
  • Member since 2022

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

Hello Folks,

I want to design a custom button such that when user click on that custom button, a drop down should appear with list of emeil template, followed by editable Email Body and recipient name. Finally, clocking on Send button in dropdown, Email will be sent to recipient. How to perform this tak? Using Trigger or Lightning Flows? Plz Suggest.

Why does the following fail to deserialize?
Blob b = Blob.valueOf('test1');
ContentVersion cv = new ContentVersion(VersionData=b);
String cvString = JSON.serialize(cv);
System.debug('ContentVersion serialized: ' + cvString);
ContentVersion cvd = (ContentVersion)JSON.deserialize(cvString, ContentVersion.class);

Output
15:15:38.4 (5368573)|USER_DEBUG|[248]|DEBUG|ContentVersion serialized: {"attributes":{"type":"ContentVersion"},"VersionData":{"asByteArray":"dGVzdDE=","inputStream":{},"length":5,"maxToKeep":6}}
15:15:38.4 (10114668)|FATAL_ERROR|System.JSONException: Cannot deserialize instance of base64 from START_OBJECT value { or request may be missing a required field at [line:1, column:40]

 

I need to write a batch class monthly that will query all child records and calculates the percentage consumed from an amount field and creates a new record in a 3rd Object.
Example:- Object "Program" has multiple children "projects"(can have more than 200) with lookup relation and has a field "Amount". The parent "Program" object has a field  "Allocated Total Amount". I have to query all children and calculate the sum of the amount and take percentages like (Sum of Amount/ Allocated Total Amount * 100). After that, I have to create a record in another object "Summary Table" with Program Name, Start Date, and End Date from the Program Object and calculated the Percentage in a field.

I am new to apex, I am writing an apex class and I have the salesforce id, how do I update the contact record if I have the salesforce id.

Thanks