Skip to content

Commit 757de5f

Browse files
authored
Fix empty layoutAssignments
Sometimes layout assigments come empty like this `<layoutAssignments><!-- 1 children --></layoutAssignments>`. We need to check if the `recordType` element exists before accessing it.
1 parent b2ddbe8 commit 757de5f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

cumulusci/tasks/salesforce/update_profile.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,11 @@ def _set_record_types(self, tree, api_name):
288288
# Look for page layout definitions in the record type
289289
found_layout = False
290290
for elem in tree.findall("layoutAssignments"):
291-
if elem.find("recordType").text == rt["record_type"]:
292-
elem.layout.text = layout_option
293-
found_layout = True
291+
record_type_elem = elem.find("recordType")
292+
if record_type_elem:
293+
if record_type_elem.text == rt["record_type"]:
294+
elem.layout.text = layout_option
295+
found_layout = True
294296

295297
if not found_layout:
296298
assignment = tree.append(tag="layoutAssignments")

0 commit comments

Comments
 (0)