Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace not being added into Flow references in minority of cases #3763

Open
asbestossupply opened this issue Mar 5, 2024 · 0 comments
Open
Labels

Comments

@asbestossupply
Copy link

Describe the bug

Summary

I'm working on an unlocked package (2gp). The code is stored in dx format and contains a few flows. During packaging, most of the field references in these packages are updated with the namespace but some are not. The result is a package that installs just fine but has broken flows.

There's ~120 field references across 10 flows and only 7 places where the namespace is not updated!

Snippets

Here's a snippet from a flow where the namespace is not added:

<extensionName>flowruntime:lookup</extensionName>
<fieldType>ComponentInstance</fieldType>
<inputParameters>
    <name>fieldApiName</name>
    <value>
        <stringValue>Field__c</stringValue>
    </value>
</inputParameters>

The Field__c is not updated in the org and this creates a runtime flow error.

And here's a snippet from a flow where the namespace is added:

    <recordUpdates>
        <name>Log_error_message</name>
        <label>Log error message</label>
        <locationX>578</locationX>
        <locationY>878</locationY>
        <filterLogic>and</filterLogic>
        <filters>
            <field>Id</field>
            <operator>EqualTo</operator>
            <value>
                <elementReference>recordId.Id</elementReference>
            </value>
        </filters>
        <inputAssignments>
            <field>Field__c__c</field>
            <value>
                <elementReference>apex_withdraw_message</elementReference>
            </value>
        </inputAssignments>
        <object>MyObject__c</object>
    </recordUpdates>

Configuration

The cumulusci.yml file includes the namespace:

project:
  name: PROJECT-NAME
  package:
    name: PROJECT-NAME
    api_version: "59.0"
    namespace: MY_NS

Build Info

The flows I use to build the package are build_unlocked_test_package followed by release_unlocked_beta. These run from Github actions.

Worth noting that even even when I explicitly prefix with %%%NAMESPACE%%% ie, updating to below does not help. This token is always replaced with "" as part of deploy which from what I can see actually is expected behavior since the orgs I'm using are not explicitly namespaced.

<extensionName>flowruntime:lookup</extensionName>
<fieldType>ComponentInstance</fieldType>
<inputParameters>
    <name>fieldApiName</name>
    <value>
        <stringValue>%%%NAMESPACE%%%Field__c</stringValue>
    </value>
</inputParameters>

running dev_org flow outputs

...
Stripping namespace tokens from metadata for unmanaged deployment
                      flows/MyFlow.flow: Replaced %%%NAMESPACE%%% with ""
...

I did try creating an explicitly namespaced org but ran into a different issue (#3762) and actually found that %%%NAMESPACE%%% was still replaced by "" anyway though perhaps there's a task option I'm missing somewhere...

Reproduction steps

Reproduction is quite hard without providing my entire codebase since, as mentioned, namespace prefixing works on most references but not all. There does not seem to be any pattern I can tell. Across 10 flows with ~120 field references, there are only 7 references that are not being updated (5 across Screens and 2 in Outcomes). If it is necessary to put together a minimal project to recreate this please lmk and I will work on that. But I suspect there's something I am missing in my setup or flows here (since I haven't seen a ton of info on unlocked package config).

I tested that like so:

  1. I ran cci flow run dev_org --org dev.
  2. Code deployed has no namespace
  3. I ran cci flow run ci_feature --org dev
  4. Then `cci flow build_unlocked_test_package --org dev'
  5. Then cci flow release_unlocked_beta --org dev

The resulting package has namespaces correctly setup throughout the package and even most of the flows. But those 7 field references are still without namespace and this causes the issues with those flows after installing the package in an org.

Your CumulusCI and Python versions

CumulusCI version: 3.84.3
Python version: 3.12.2

Operating System

MacOS 14.2

Windows environment

No response

CumulusCI installation method

pipx

Error Gist

No response

Additional information

I suspect the issue itself is not a bug per se in CumulusCI but rather an issue with Flows/packaging and I'm wondering if there's a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant