diff --git a/cumulusci/tasks/salesforce/EnsureRecordTypes.py b/cumulusci/tasks/salesforce/EnsureRecordTypes.py
index e9db3dfff4..c7e793f09b 100644
--- a/cumulusci/tasks/salesforce/EnsureRecordTypes.py
+++ b/cumulusci/tasks/salesforce/EnsureRecordTypes.py
@@ -1,5 +1,6 @@
import os
import re
+from xml.sax.saxutils import escape
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.utils import process_bool_arg
@@ -152,7 +153,7 @@ def _build_package(self):
record_type_developer_name=self.options[
"record_type_developer_name"
],
- stage_name=self.options["stage_name"],
+ stage_name=escape(self.options["stage_name"]),
default=default,
)
business_process_link = BUSINESS_PROCESS_LINK.format(
diff --git a/cumulusci/tasks/salesforce/tests/test_EnsureRecordTypes.py b/cumulusci/tasks/salesforce/tests/test_EnsureRecordTypes.py
index ee165b5640..40d0e3e1b1 100644
--- a/cumulusci/tasks/salesforce/tests/test_EnsureRecordTypes.py
+++ b/cumulusci/tasks/salesforce/tests/test_EnsureRecordTypes.py
@@ -15,7 +15,7 @@
NPSP_Default
true
- Test
+ Identify & Qualify
false
@@ -79,7 +79,7 @@
"name": "StageName",
"picklistValues": [
{"value": "Bad", "active": False},
- {"value": "Test", "active": True},
+ {"value": "Identify & Qualify", "active": True},
],
},
],
@@ -134,7 +134,7 @@ def test_infers_correct_business_process(self):
assert task.options["generate_business_process"]
assert task.options["generate_record_type"]
- assert task.options["stage_name"] == "Test"
+ assert task.options["stage_name"] == "Identify & Qualify"
def test_no_business_process_where_unneeded(self):
task = create_task(
@@ -178,7 +178,6 @@ def test_generates_record_type_and_business_process(self):
with open(os.path.join("objects", "Opportunity.object"), "r") as f:
opp_contents = f.read()
assert OPPORTUNITY_METADATA == opp_contents
- assert OPPORTUNITY_METADATA == opp_contents
with open(os.path.join("package.xml"), "r") as f:
pkg_contents = f.read()
assert PACKAGE_XML == pkg_contents
@@ -203,8 +202,8 @@ def test_generates_record_type_and_business_process__case(self):
with temporary_dir():
task._build_package()
with open(os.path.join("objects", "Case.object"), "r") as f:
- opp_contents = f.read()
- assert CASE_METADATA == opp_contents
+ case_contents = f.read()
+ assert CASE_METADATA == case_contents
with open(os.path.join("package.xml"), "r") as f:
pkg_contents = f.read()
assert PACKAGE_XML == pkg_contents