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
ahonahon 
If picklist field status = VOID, then user cannot update or edit record.

I keep running into a solution where a validation rule or flow prevents user from updating picklist to void. This is not the requirement. The requirement is once the status is already changed to VOID and the record is saved, then no further updates or edits can be made.
Best Answer chosen by ahon
VinayVinay (Salesforce Developers) 
Hi Ahon,

You can try below validation rule.
AND(
NOT(ISNEW()), 
ISPICKVAL(PRIORVALUE(status),"VOID")
)
Please mark as Best Answer if above information was helpful.

Important Update - last chance

Heads up — this is your last chance to get your Trailblazer account set up and connected to your forums discussions on this site.Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Communitysign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Find more info & support
We know that moving platforms can be a hassle, so we created a special forums users group, the Migration Support Hub, in the Trailblazer Community where you can find other forums users and get training videos, the latest information, and assistance.We want to thank you for all of your time, energy, and contributions made here in the Salesforce Discussion Forums.
We’ll see you in the Trailblazer Community!

Thanks,
Jean-Se DoraisJean-Se Dorais 
Hello all,

I've got a 'FundingAwardTrigger' on the FundingAward object (part of the Grantmaking package).  When I run the test in Sandbox, I get 100% coverage.

When I validate the Inbound Change Set in Prod, I get the following error:

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
FundingAwardTrigger

Here's my test class:
 
@isTest
private class FundingAwardTriggerTest {

    @isTest static void testTriggerOnInsert() {
        // Create a test record for the insert operation
        FundingAward testAwardInsert = new FundingAward(Name = 'Test Insert', Amount = 100);

        // Start the test context
        Test.startTest();

        // Perform the insert operation
        insert testAwardInsert;

        // Stop the test context
        Test.stopTest();

        // Retrieve the inserted record and assert the result
        testAwardInsert = [SELECT Currency_Text__c FROM FundingAward WHERE Id = :testAwardInsert.Id];
        System.assertEquals('One Hundred', testAwardInsert.Currency_Text__c, 'Trigger did not work as expected on insert');
    }

    @isTest static void testTriggerOnUpdate() {
        // Create and insert a record for the update operation
        FundingAward testAwardUpdate = new FundingAward(Name = 'Test Update', Amount = 100);
        insert testAwardUpdate;

        // Start the test context
        Test.startTest();

        // Perform the update operation
        testAwardUpdate.Amount = 200;
        update testAwardUpdate;

        // Stop the test context
        Test.stopTest();

        // Retrieve the updated record and assert the result
        testAwardUpdate = [SELECT Currency_Text__c FROM FundingAward WHERE Id = :testAwardUpdate.Id];
        System.assertEquals('Two Hundred', testAwardUpdate.Currency_Text__c, 'Trigger did not work as expected on update');
    }

 		@isTest static void testBulkOperation() {
        // Create multiple records for testing bulk operation
        List<FundingAward> awards = new List<FundingAward>();
        for (Integer i = 1; i <= 10; i++) {
            awards.add(new FundingAward(Name = 'Bulk Test Award ' + i, Amount = i * 100));
        }

        // Start the test context
        Test.startTest();

        // Perform bulk insert
        insert awards;

        // Update the records for bulk update test
        for (Integer i = 0; i < awards.size(); i++) {
            awards[i].Amount += 1000;
        }

        // Perform bulk update
        update awards;

        // Stop the test context
        Test.stopTest();

        // Optional: Add assertions here to validate the trigger's behavior on bulk operations
    }

}
Why would my test class show 100% in sandbox but 0% in prod?

Any tips appreciated!
 
Best Answer chosen by Jean-Se Dorais
Jean-Se DoraisJean-Se Dorais
Solved.  The FundingAwardTriggerTest test class was omitted from my outbound change set.  Including it solved the issue!
ahonahon 
Is there a way to prevent record deletion based on, for example, a status field without using code?
Best Answer chosen by ahon
DishantDishant (Salesforce Developers) 
Hi Ahon,

Please find the below articles which might help you! 

https://developer.salesforce.com/forums/?id=9062I000000g5mEQAQ 

Using Flow to Prevent Record Deletion (https://salesforcetime.com/2023/09/03/using-flow-to-prevent-record-deletion/#:~:text=1%2D%20Create%20a%20record%2Dtriggered,flow%20should%20look%20like%20this.

Please mark this as a best answer if this was useful. Thank you! 

Important Update - what you need to do

As a reminder, on December 4, 2023 the Salesforce Discussion Forums will be removed from the Salesforce Developers website. These forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform.

During the week starting November 20, you can view discussions, but not post new questions or responses. On December 4, you will no longer be able to access the discussion forums from the Salesforce Developers website.

Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Community, sign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Find more info & support
We know that moving platforms can be a hassle, so we created a special forums users group, the Migration Support Hub, in the Trailblazer Community where you can get training videos, information, and assistance.

We are here to help you through this transition!

Sincerely,
The Forums Support Team
 
Kavitha H 5Kavitha H 5 
What object must an admin populate to create Digital Wallet type payment methods, such as ApplePay or Electronic Gift Certificate?
  1. AlternativePaymentMethod
  2. PaymentGateway Provider
  3. GtwyProvPaymentMethodType
  4. CardPaymentMethod
Best Answer chosen by Kavitha H 5
SwethaSwetha (Salesforce Developers) 
HI Kavitha,

The object that an admin must populate to create Digital Wallet type payment methods, such as ApplePay or Electronic Gift Certificate, in Salesforce is the "AlternativePaymentMethod" object. This object represents a payment method that isn't defined by the CardPaymentMethod or DigitalWallet entity, and it includes examples of alternative payment methods, such as digital wallet options and electronic gift certificates

Therefore, the correct answer is:
A. AlternativePaymentMethod

Related: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_alternativepaymentmethod.htm


Important Update - what you need to do

As a reminder, on December 4, 2023 the Salesforce Discussion Forums will be removed from the Salesforce Developers website. These forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform.

During the week starting November 20, you can view discussions, but not post new questions or responses. On December 4, you will no longer be able to access the discussion forums from the Salesforce Developers website.

Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Community, sign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Find more info & support
We know that moving platforms can be a hassle, so we created a special forums users group, the Migration Support Hub, in the Trailblazer Community where you can get training videos, information, and assistance.

We are here to help you through this transition!

Sincerely,
The Forums Support Team
 
Andy Morton 14Andy Morton 14 
Hello all,

I've been working on some API integration between Salesforce and SQL using Powershell. 

So far I've managed to get the majority working with querying Salesforce for some record details, grabbing information from SQL and inserting the SQL data into the Salesforce records. 

However, I'm having some trouble trying to get it to create a new record. 

We have a custom object (Usage_Billings__c) which the SQL data is put into. Inserting this into existing records is fine but if I try to create a new record it fails with error "Unexpected character ('P' (code 80)): was expecting comma to separate OBJECT entries at [line:3, column:33]","errorCode":"JSON_PARSER_ERROR"

I'm fairly new to API integrations and haven't had much luck with finding a solution online (according to some posts, what I'm doing should work fine). 

My Script:

(I've omitted our SF connection section which works fine as can gather the information fine as well as our sandbox URL)
 
$GUID = "810Pu000001MruoIAC"

$getContracturl = "https://MYSANDBOX.my.salesforce.com/services/data/v57.0/query?q=SELECT+FIELDS(ALL)+FROM+servicecontract+WHERE+id+=+'$GUID'+LIMIT+50"
$getContractResponse = Invoke-RestMethod -Uri $getContracturl -Method 'Get' -Headers $headers -TimeoutSec 0.03
$getContractResponse | ConvertTo-Json -Depth 10

$accountid = $getContractResponse.records.accountid
$dat_size = "150"
$lic_365 = "1"
$lic_google = "1"



$createUrl = "https://MYSANDBOX.my.salesforce.com/services/data/v57.0/sobjects/Usage_Billing__c"
$requestbody =@"
{

    "Service_Contract__c" : $GUID,
    "Stor__c" : $dat_size,
    "X365_Users__c" : $lic_365,
    "G_Users__c" : $lic_google
 


}
"@


Write-Host $requestbody

$createBilling = Invoke-RestMethod -Uri $createUrl -Method 'Post' -Headers $headers -Body $requestbody -TimeoutSec 0.03
$createBilling | ConvertTo-JSON
Anyone able to point me in the right direction?

All help appreciated.

Andy
 
Best Answer chosen by Andy Morton 14
Andy Morton 14Andy Morton 14
Never mind, realised I didn't encapsulate the $GUID variable in quotations. 

"Service_Contract__c" : "$GUID",

All working now - will leave this here in case anyone else comes across same issue (shows that something simple can waste loads of time :) )
Eric KellyEric Kelly 
I need to require that users with our "Sales User" profile fill out a specific set of fields when the move an opportunity in to our "Closed Won" stage.  Other users/profiles will not have this requirement. 

I have other similar versions of this rule for a single field for all users and it works, but for this exercise, I need to account for 9 required fields and only with a specific profile.  My formula is not returning errors, but when I tested this with a Sales User, SF did not require them to fill out the fields.  I did change their profile moments before asking them to test.  Do Profiles take a few minutes to reflect a change.  (Yes - I did have them sign out, changed the profile, then had them sign back in.)

My current validation rule formula is:

AND(
CASE( StageName ,
"Closed Won", 1 ,
0 ) = 1 ,
ISBLANK( Vendor_Rep__c ),
ISBLANK( Vendor_Rep_Help__c ),
ISBLANK( Business_Challenges__c ),
ISBLANK( Business_Win_Process__c ),
ISBLANK( Key_Takeaway__c ),
ISBLANK( Solution_Search__c ),
ISBLANK( Competition__c ),
ISBLANK( Overcoming_Competition__c ),
ISBLANK( Implementation_Details__c ),
$Profile.Name = "Sales User"
)

Thanks for the help!
Best Answer chosen by Eric Kelly
HarshHarsh (Salesforce Developers) 
Hi Eric,

Please try the below code
 
AND(
    ISPICKVAL(StageName, "Closed Won"),
    $Profile.Name = "Sales User",
    OR(
        ISBLANK(Vendor_Rep__c),
        ISBLANK(Vendor_Rep_Help__c),
        ISBLANK(Business_Challenges__c),
        ISBLANK(Business_Win_Process__c),
        ISBLANK(Key_Takeaway__c),
        ISBLANK(Solution_Search__c),
        ISBLANK(Competition__c),
        ISBLANK(Overcoming_Competition__c),
        ISBLANK(Implementation_Details__c)
    )
)

Please mark it as Best Answer if the above information was helpful.

Thanks.




Important Update - what you need to do
User-added image
As a reminder, on December 4, 2023 the Salesforce Discussion Forums will be removed from the Salesforce Developers website. These forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform.

During the week starting November 20, you can view discussions, but not post new questions or responses. On December 4, you will no longer be able to access the discussion forums from the Salesforce Developers website.

Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Communitysign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Find more info & support
We know that moving platforms can be a hassle, so we created a special forums users group, the Migration Support Hub, in the Trailblazer Community where you can get training videos, information, and assistance.

We are here to help you through this transition!

Sincerely,
The Forums Support Team
Chris PitirriChris Pitirri 
My team isn not sure if using the OOB FSC Tax ID to store the individual SSN was the what the field was meant for. We need to determine if Tax ID should be used and if we need to delete our custom field.
Best Answer chosen by Chris Pitirri
VinayVinay (Salesforce Developers) 
As per below doc, try using TaxId__c field and it doesnt mention it has only four digits, you might be using LastFourDigitSSN__c field.  Kindly recheck and also FSC expert can give more inputs on this if you have any further queries.

https://developer.salesforce.com/docs/atlas.en-us.financial_services_cloud_object_reference.meta/financial_services_cloud_object_reference/fsc_api_objects_contact_custom_fields.htm

Please mark as Best Answer if above information was helpful.

Thanks,
ahonahon 
Is there a way to have 2 conditions in a formula under validate input on a screen component? Currently, the following is, in fact, working and triggering an error message:

{!Cancellation_Date} <= TODAY()

However, there are 2 conditions required and each time I attempt to add another condition, as seen below, the flow fails.

AND(
    {!Cancellation_Date} <= TODAY(), 
    {!Cancellation_Date} >= Sale_Date__c
)
Best Answer chosen by ahon
HarshHarsh (Salesforce Developers) 
Hi Ahon,
 
{!Cancellation_Date} <= TODAY() &&
    {!Cancellation_Date} >= Sale_Date__c

Please try the above code in your Validate input option in the screen flow

Please mark it as Best Answer if the above information was helpful.

Thanks.




Important Update - what you need to do
User-added image
As a reminder, on December 4, 2023 the Salesforce Discussion Forums will be removed from the Salesforce Developers website. These forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform.

During the week starting November 20, you can view discussions, but not post new questions or responses. On December 4, you will no longer be able to access the discussion forums from the Salesforce Developers website.

Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Communitysign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Find more info & support
We know that moving platforms can be a hassle, so we created a special forums users group, the Migration Support Hub, in the Trailblazer Community where you can get training videos, information, and assistance.

We are here to help you through this transition!

Sincerely,
The Forums Support Team
 
Miguel Egas 7Miguel Egas 7 
Hi Folks, I have the following validationformula that is supposed to prevent the creation of the record unless the criteria is met, however, after implementing the validation, the record still gets created if a choose a date in the past.  For example if today is nov 13, and I chose Oct 20, the record should not be created.  What am I doing wrong?
 
AND(
  WEEKDAY(Survey_Requested_Date__c) <> 2,  /* Not Monday */
  WEEKDAY(Survey_Requested_Date__c) <> 6,  /* Not Friday */
  Survey_Requested_Date__c >= TODAY()      /* Date is in the future */
)

 
Best Answer chosen by Miguel Egas 7
Miguel Egas 7Miguel Egas 7
Never mind, I fixed my own error, but just in case someone else has the same problem, here is the solution:
AND(
Survey_Requested_Date__c>=Today(),
WEEKDAY(Survey_Requested_Date__c) = 2 || WEEKDAY(Survey_Requested_Date__c) = 6
)
Basically, the formula needed to be AND OR
Th pipes || are an OR statement, thus the second condition for AND includes and OR.  

 
GAURAV SETHGAURAV SETH 
Hi,
Can some one please suggest any Free AppExchange tool which can be used to export description of the fields from Standard and custom objects from Salesforce Org ?
I am able to search few of them but they have paid version to export description fields.

Thanks in advance
Best Answer chosen by GAURAV SETH
HarshHarsh (Salesforce Developers) 
Hi Gaurav,
  • First, you have to install the Google extension "Salesforce Inspector".
  • Please check the below link of the Salesforce inspector extension.
  • https://chrome.google.com/webstore/detail/salesforce-inspector/aodjmnfhjibkcdimpodiifdjnnncaafh 
  • In Salesforce Inspector click on Data Export and write the below query.
    SELECT QualifiedApiName,  Description
    FROM FieldDefinition 
    WHERE EntityDefinition.DeveloperName='Account'
    
  • You can download the query result in CSV, Jason, and Excel format.
  • You can use a data loader and workbench for the same.
Please mark it as Best Answer if the above information was helpful.

Thanks.

Heads up about the Forums shut down

User-added image
Important Update

We appreciate your participation in these Salesforce Discussion Forums! It’s active members like you that keep our amazing community going strong.

At this time, we want to give you a heads up that on December 4, 2023, the discussion forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform. This move brings all conversations around Salesforce development together in one place and provides more opportunities for our broader community to connect and share. We will be removing outdated, obsolete, or spam content and migrating only relevant discussions to the Trailblazer Community digital platform.

Starting November 20, you can view discussions but not post new questions or responses. On December 2, you will no longer be able to access the discussion forums from the Salesforce Developers website.

Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Communitysign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from the one you used for your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Once you’re in the Trailblazer Community, join the Migration Support Hub users group to help you navigate this transition.

We will keep you up to date throughout the transition, and we look forward to seeing you joining the developer discussions in the Trailblazer Community!

Sincerely,
The Forums Support Team