Sunday, December 18, 2022

How do you bind an Apex controller to a Visualforce page?

 In Visualforce, to reference an Apex method in the component markup, you must bind an Apex contoller to the Visualforce page. We do this by specifying  it as an attribute in the <apex:page> tag. 

Here's an example of how to do this:

<apex:page controller="MyController"> <!-- page content goes here --> </apex:page>

In this example, MyController is the name of the Apex controller class that you want to bind to the Visualforce page.

You can also specify multiple controllers by separating them with a comma, like this:

<apex:page controller="MyController1, MyController2"> <!-- page content goes here --> </apex:page>

It's important to note that the Apex controller class must be defined in your organization before you can bind it to a Visualforce page. 

public with sharing class MyController { // controller logic goes here }

Once you have defined your Apex controller class and specified it in the <apex:page> tag, you can use the controller's methods and variables in your Visualforce page to control the page's behavior and display dynamic content.

Thursday, May 14, 2020

SFDX force:source:push returns error: PartnerAccountId.field-meta.xml fullName must end with: __c or __kav or __x or __b or __xo or __e or __p or __mdt

Problem / Issue:

Having just retrieved the Opportunity object into my DX Project, I tried to push the source into a newly created ScratchOrg.

> sfdx force:source:retrieve -m CustomObject:Opportunity -u DevHub
... pulled down the metadata for a bunch of components

> sfdx force:source:push

The push operation gave me the following error:
fullName must end with: __c or __kav or __x or __b or __xo or __e or __p or __mdt (363:13)


The PartnerAccountId is only visible (on Opportunity and Lead records) when an Admin enables Salesforce Partners or purchases Salesforce Partner Community licenses.

To enable this feature in a ScratchOrg, the following features and settings must be defined in the project-scratch-def.json config file.

    "orgName": "myOrg",
    "edition": "Developer",
    "features": ["Communities", "EnablePRM"],
    "settings": {
        "communitiesSettings": {
            "enableNetworksEnabled": true,
            "enableEnablePRM": true
        "lightningExperienceSettings": {
            "enableS1DesktopEnabled": true

Tuesday, May 12, 2020

SFDX force:source:push returns error: no QuickAction named FeedItem.ContentNote found

I wanted to add a specific page layout from Production to my SFDX project. After retrieving the metadata from production, I got an error message when trying to push it into a scratch org:

force-app\main\default\layouts\Opportunity-Opportunity Standard Layout.layout-meta.xml
In field: QuickAction - no QuickAction named FeedItem.ContentNote found
ERROR running force:source:push:  Push failed.

This error occurs because Enhanced Notes has not been enabled in the Scratch Org.

Remedy this by updating the project-scratch-def.json file to include the following settings:

    "settings": {
        "enhancedNotesSettings": {
            "enableEnhancedNotes": true