2

I've developed a managed package containing a Lightning Page, which embeds the Quip Document standard component, thus:

Lightning Page configuration

The component is configured to store its document URL in a field called "Quip Document URL" (Quip_Document_URL__c), thus:

Configuration of Quip component

But when I attempt to upload my 2GP package version, I get a mysterious error:

[Error]: Package creation failed with error:
Media_Item_Record_Page: Component [forceContent:embeddedQuipComponent] 
attribute [configurationData]: Attribute value is not valid

What's going on?

1 Answer 1

2

The actual metadata for the Quip component is this:

<componentInstance>
    <componentInstanceProperties>
        <name>configurationData</name>
        <value>{&quot;appBuilderConfig&quot;:{&quot;optionSelected&quot;:1},&quot;linkSharingMode&quot;:&quot;view&quot;,&quot;documentRecordFieldName&quot;:&quot;Quip_Document_URL__c&quot;,&quot;componentTitle&quot;:&quot;Document&quot;}</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>
{&quot;appBuilderConfig&quot;:{&quot;optionSelected&quot;:1},&quot;linkSharingMode&quot;:&quot;view&quot;,&quot;documentRecordFieldName&quot;:&quot;%%%NAMESPACED_ORG%%%Quip_Document_URL__c&quot;,&quot;componentTitle&quot;:&quot;Document&quot;}
</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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .