The actual metadata for the Quip component is this:
<componentInstance>
<componentInstanceProperties>
<name>configurationData</name>
<value>{"appBuilderConfig":{"optionSelected":1},"linkSharingMode":"view","documentRecordFieldName":"Quip_Document_URL__c","componentTitle":"Document"}</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>height</name>
<value>600</value>
</componentInstanceProperties>
<componentName>forceContent:embeddedQuipComponent</componentName>
</componentInstance>
That horrible mess of JSON in the configurationData
element converts to
{
"appBuilderConfig": {
"optionSelected": 1
},
"linkSharingMode": "view",
"documentRecordFieldName": "Quip_Document_URL__c",
"componentTitle": "Document"
}
The key here is that the Quip_Document_URL__c
field reference does not contain the namespace of this managed package. In most cases, packaging correctly resolves field references without the namespace to the component included in the package. However, there are a number of edge cases like this one, where component references are embedded in a second layer of structured data inside component XML.
In such situations, references can fail to resolve correctly to the packaged component, and we have to help the packaging system along. In this case, I'm building my package with CumulusCI, which allows the use of context-sensitive namespace injection tokens in metadata. These are dynamically replaced by the actual namespace at deployment time. I added %%%NAMESPACED_ORG%%%
to Quip_Document_URL__c
:
<value>
{"appBuilderConfig":{"optionSelected":1},"linkSharingMode":"view","documentRecordFieldName":"%%%NAMESPACED_ORG%%%Quip_Document_URL__c","componentTitle":"Document"}
</value>
and my package upload worked. If I weren't using CumulusCI, I could write a script to inject this value before running sfdx force:package:version:create
, or I could choose to include a static namespace reference in my metadata. I don't like to have static namespace references because they preclude the use of non-namespaced scratch orgs.