Posts

Showing posts with the label field

Salesforce Fact #969 | LWC GraphQL mutation with address field

Image
While creating records with address field using GraphQL mutation feature, we need to specify each of the constituting field values of the address. For country and state, the statecode and countrycode counterparts won't work. Example error: contains a field not in 'ContactCreateRepresentation': 'MailingCountryCode' And while fetching the data, we need to specify the constituent fields as the compound field won't work. Example error: Validation error (FieldUndefined@[uiapi/ContactCreate/Record/MailingAddress/value]) : Field 'value' in type 'Contact_MailingAddress_CompoundField' is undefined Attached is the screenshot of the correct syntax.

Salesforce Fact #901 | Few things to consider while using Data Import Wizard

Here are two things to keep in mind while importing records with Data Import Wizard: 1) The fields available for mapping is based on the layout of the selected record type and the field level security of the user. 2) While importing records we need to select a checkbox named 'Trigger workflow rules and processes for new and updated records' in order to trigger the automations in place for that object. Reference:  https://help.salesforce.com/s/articleView?id=000387837&language=en_US&type=1

Salesforce Fact #830 | Making field readonly after record creation using field section

Image
Suppose we want to keep a field editable only during the record creation, and once record is created it should be read only in the UI level(for non-admin users). Apart from validation rule, we can make use of field section in lightning app builder to implement the same. In this example, the LeadSource field on opportunity is made read only once it is created by keeping two field instances with two different filters. Note: Field section does not work for community. Attached are the screenshots.

Salesforce Fact #726 | Accessing polymorphic fields in graphQL LWC

Image
How do you access Polymorphic fields in graphQL wire adapter in LWC? Suppose we want to access the related case owner names of an account in graphQL. Since, Case Owner is a polymorphic field so we need to consider both the user and queue owner possibilities. Reference:  https://developer.salesforce.com/docs/platform/lwc/guide/reference-graphql-relationships.html Attached are the screenshots.

Salesforce Fact #617 | Fetching field help text

While trying to fetch the field help text using SOQL on FieldDefinition object, we get the below error: No such column 'inlinehelptext' on entity 'FieldDefinition'. So, to get the help text we can use the getDescribe() call in the format: SobjectApiName.FieldApiName.getDescribe().getInlineHelpText(). For example, Account.AccountSource.getDescribe().getInlineHelpText();

Salesforce Fact #589 | Access PersonAccount field in LWC

Image
In order to access Person Account fields, the import statement won't work in LWC for Account. We need to specify it the other way as a constant. Attached is the screenshot.