• Krishna V
  • NEWBIE
  • 35 Points
  • Member since 2022

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
Hello All,
I am working on a LWC.  Currently I can retrieve the record Id and pass it to a handler
@api recordId;

console.log('Job RecordId is ' + this.recordId);

getContactName{recordId : this.recordId})

Now I want to pass another field off the record but unsure how to retrieve it.  I tried this but it does not work
import JOB_NAME_FIELD from '@salesforce/schema/Contact__c.Job_Name__c';

getFieldValue(this.recordId, JOB_NAME_FIELD);

Any suggestions would be greatly appreciated.
Thanks
P
 
I want to understand what Metadata types are considered FirstClass and what metadata types are considered SecondClass in salesforce. Is there a list published somewhere that I can refer to or can someone tell me if ApexClass is a first-class metadata type? 
I have a basic question, we have a lightning component on an object that we use to let users approve records in the approval process without them being the approvers. For this to work, we assigned 'Modify all' on object to users who need to approve these records through a permission set, but this is opening up more access than needed to users, the apex class behind the lightning component implements with sharing currently, Can we change it to without sharing and would that be same as Modify all on the object but just in the context of the class invocation? 
Hello. I am getting this error: Compile Error: Expecting '}' but was: '<EOF>' at line 8 column 1

Here's the apex class:

trigger CompleteResolutionTimeMilestone on Case (after update) 
{    if (UserInfo.getUserType() == 'Standard')
{        DateTime completionDate = System.now();            
 List<Id> updateCases = new List<Id>();            
 for (Case c : Trigger.new)
 {  if (((c.isClosed == true)||(c.Status == 'Closed'))&&((c.SlaStartDate      <= completionDate)&&(c.SlaExitDate == null)))        updateCases.add(c.Id);        }
 
    if (updateCases.isEmpty() == false)        milestoneUtils.completeMilestone(updateCases, 'Resolution Time', completionDate); // Pass your milestone parameters to the Apex Handler Class    }}
Hi,
I have a platform event.  When the platform event trigger fires, it does a callout to a 3rd party REST API.  The Apex method is marked @future(callout = true).  If the 3rd party REST API has a timeout, I would like to have the platform event retry.

The issue is since the code is @future(callout = true), the platform event fires and doesn't wait to see if the callout completes.

Is there a way to catch the timeout in my Apex code and have it cause the platform event to later retry?

thank you
can we make method name in a test class same as class name for test class in apex salesforce
Hello Salesforce Community,
I am currently facing an issue with the automatic token refresh in my Salesforce organization and I'm hoping someone might be able to help.
Here's a brief overview of my setup: I have configured Named Credentials with Keycloak as the Auth Provider, and Azure AD as the identity provider for Keycloak. This setup works well for initial authentication, but I'm running into problems when the access token expires.
From what I understand, Salesforce should automatically use the refresh token to obtain a new access token when the current one expires. However, I'm receiving 401 errors indicating that the access token is invalid, and the token does not seem to be refreshing automatically.
As a temporary workaround, I've been manually revoking the access in the External Credential, which forces a new authentication and thereby obtains a new access token. However, this is not a sustainable solution as it disrupts the user experience and requires manual intervention.
Has anyone else experienced this issue or have any suggestions on how to resolve it? Any insights or advice would be greatly appreciated.
Thank you in advance for your help.
  • July 17, 2023
  • Like
  • 0

Hello! 

I hope all of you are doing well. I have 15 picklist fields and if a user chose the "Other" value, the user will have to specify as to why they have chosen "Other" and this information will be in a text field. Below is only an example

Picklist Field A -> If User chose "Other" in Picklist Field A, a Text Field A - Other would pop up
Picklist Field B -> If User chose "Other" in Picklist Field B, Text Field B - Other would pop up 

I am trying to create a custom coding that would update the Text Fields to null if the Picklist Field values are not set to "Other". 

Below is the Apex Class that I have created:

public class PicklistUpdateHandler {
    public static void updateTextFieldsToNull(List<Ribbonfish__Title__c> records) {
        List<Ribbonfish__Title__c> recordsToUpdate = new List<Ribbonfish__Title__c>();
       
        for (Ribbonfish__Title__c record : records) {
            if (record.Ribbonfish__SMUR_on_AuthorsWebpage__c != 'Other' && record.Ribbonfish__SMUR_on_AuthorsWebpage__c != record.Ribbonfish__SMUR_on_AuthorsWebpage__c) {
                record.Ribbonfish__SMURAuthorsPersonalWebpageOther__c = null;
                recordsToUpdate.add(record);
            }
           
            if (record.Ribbonfish__SMUR_onDepartmentalWebpage__c != 'Other' && record.Ribbonfish__SMUR_onDepartmentalWebpage__c != record.Ribbonfish__SMUR_onDepartmentalWebpage__c) {
                record.Ribbonfish__SMURDepartmentalWebpageOther__c = null;
                recordsToUpdate.add(record);
            }
           
            
        }
       
        if (!recordsToUpdate.isEmpty()) {
            update recordsToUpdate;
        }
    }
}

Just a heads up, this is my first time creating Apex and I am not certified as Salesforce Developer. Everyone is welcome to share their thoughts and I'm looking forward to your response. 

Thank you and stay safe!

-Aleina :)


There are some Salesforce REST APIs which needs to be consumed by client application. The API Request should be externally authenticated by Azure AD using Azure AD's OAuth app registration and Salesforce OAuth2.0 authentication is not required. However Salesforce should be able to validate the Access Token provided by Azure AD by calling an Azure URL for token validation.

Please suggest if there is a way to achieve this without using Salesforce OAuth2.0 Authentication.
 Whenever an opportunity is created between Jan 1 2022 and June 30 2022, a discount percentage field should be populated as 10% and the Opportunity amount should be discounted with the same percentage – Write an Apex logic to achieve this
Hello All,
I am working on a LWC.  Currently I can retrieve the record Id and pass it to a handler
@api recordId;

console.log('Job RecordId is ' + this.recordId);

getContactName{recordId : this.recordId})

Now I want to pass another field off the record but unsure how to retrieve it.  I tried this but it does not work
import JOB_NAME_FIELD from '@salesforce/schema/Contact__c.Job_Name__c';

getFieldValue(this.recordId, JOB_NAME_FIELD);

Any suggestions would be greatly appreciated.
Thanks
P