function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Debendra Ray 8Debendra Ray 8 

== operator is returning false although the operands are same in apex

Hi,

Issue is : == operator is returning false although the operands are same on both sides of the operator  - statement is below:

System.debug('DEBUG:approvalForProposalPricingDeviation::: BEGIN INVOKATION ********quNew.Status---->'+quNew.Status );-- This prints out the value : Pending Approval with RM-West for Pricing Deviation
if(quNew.Status == 'Pending Approval with RM-West for Pricing Deviation'  ){
           
             submitForApproval(quNew);         
  }
System.debug('DEBUG:approvalForProposalPricingDeviation::: END INVOKATION ********quNew.Status---->'+quNew.Status );

Please could someone suggest what's going wrong here in the code snippet?

An early response on this will be much appreciated.

Regards,

Debendra 
        
Hey SandboxHey Sandbox
As per above statement, it should work perfectly. But, sometimes problem with some white space characters causing this. Mostly it will be problem with Copy and Paste strings from other documents.
Can you please check with typing Status value manually in your debug statement.
RD@SFRD@SF
Hi Ray,

One possible issue could be, if the status field is a picklist value, then check the api name of the picklist value, some times they are not the same as the picklist label and might be the issue.

Worth a try
RD
om gupta(sfdc)om gupta(sfdc)
hi either we lowercase all the string both of the side and trim also . hope that help