Category: Salesforce

  • What Should Be Global in a Packaged @InvocableMethod?

    What Should Be Global in a Packaged @InvocableMethod?

    Question I’m developing an @InvocableMethod action in Apex that will be included in a managed package. The Salesforce documentation appears inconsistent regarding what elements need to be marked global. From my testing, I have observed that the top-level class must be global. The @InvocableMethod itself seems to work when left public. Inner classes used for…

  • How to Send Case Survey to SuppliedEmail on Case Closure?

    How to Send Case Survey to SuppliedEmail on Case Closure?

    Question I have created a survey to collect customer feedback, and I would like to send it to the email address in the “SuppliedEmail” field on the Case. I have explored using Case Auto-Response Rules and the Support Settings – Customer Feedback Survey, but I was unable to find a way to send the survey…

  • Can Named Credential merge fields be used in URLs?

    Can Named Credential merge fields be used in URLs?

    Question You might want to pass dynamic values such as authentication details into the URL for an external service using Named Credentials. However, the issue arises because merge fields like {!$Credential.Password} or {!$Credential.UserName} do not get decoded until the request is actually sent, making it difficult to directly pass these as URL parameters. You’ve tried…

  • How to Get Dependent Picklist Options in Apex?

    Question How to Retrieve Dependent Picklist Values in Apex? I am working with a pair of dependent picklists and need to determine the valid options in the dependent field for each value in the controlling field using Apex. Here’s an example setup: I’ve attempted to use getPicklistValues(), but it doesn’t provide dependency information. Ideally, I’m…

  • How to Notify When Attachment Added to Custom Object?

    How to Notify When Attachment Added to Custom Object?

    Question You want to send an email notification whenever an attachment is uploaded to a custom object in Salesforce. Attachments in Salesforce are now represented as ContentDocument records, and their relationship to other records is managed through ContentDocumentLink objects. The challenge lies in correctly identifying when an attachment is associated with your custom object because…

  • How to Deserialize JSON into Apex Classes?

    How to Deserialize JSON into Apex Classes?

    Question How to Deserialize a JSON String to Apex Objects? I need to deserialize the following JSON string into Apex objects in Salesforce: Here’s what I’ve tried so far: My Questions: Keywords: Apex, JSON, Map, Deserialize, Salesforce Answer There is a more efficient way to handle this using the JSON.deserialize method with a structured Apex…

  • Enable Email Button in Task Object?

    Question: I am trying to enable the Email action button within the Task object, similar to the functionality available in the Activity Timeline. However, I am unable to add the Activity Timeline, which contains the Email button, or simply add the Email button within the Task object. I have attempted to add the Email Lightning…

  • Why is instanceof inconsistent in Apex collections?

    Question In Apex, the following behavior seems inconsistent: My Question: Answer The Apex type system, particularly regarding collections like Map, Set, and List, has certain inconsistencies that can cause confusion. Consider the following code snippet: This behavior raises the question: Why does m instanceof Map<String, Object> evaluate to true, but m instanceof Map<Object, Object> evaluates…

  • How to Fix MyIterable Constructor Error?

    Question “The constructor MyIterable should accept parameter of type List<String>.” I am unable to complete the “Get Hands-On with an Iterable Variable in For Loops” Trailhead module because I keep getting the following error message: Here is the code I have for my MyIterable class, where its constructor is supposed to accept a List<String> parameter:…

  • Add Dynamic CC in Salesforce Flow?

    Question How can I dynamically add a CC recipient address list in Salesforce Flow? Answer To dynamically add CC recipients in Salesforce Flow while sending emails, you can use a combination of Email Alerts and Flows. Here’s a structured explanation of the process and its variations. Option 1: Using Email Alert with Flow To achieve…

Open Chat
1
Dear Sir/Madam
How can I help you?