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
WoosterWooster 

C# Create Case and Assign a Page Layout

I am using C# to create a Case in Salesforce but I am unable to assign this Case a Page Layout.  We have a lot of custom fields and flows to assign certain Page Layouts based on criteria.  Since I am unable to assign a Page Layout to the newly created Case, some of the fields that I am populating are not showing.  Does anyone have any sample code on how to assign a Page Layout to a Case?
Best Answer chosen by Wooster
Bhawana Mehta SFDCBhawana Mehta SFDC
In Salesforce, Page layout isnt assigned to a Record rather Record Type is assigned to a record. Based on record type, Page layout get auto assigned to record.
In your code check what record type(RecordTypeId) you are assigning to the record, cehck the corresponding page layout to validate if the page layout has all the fields.