Skip to content

Commit

Permalink
Merge pull request #117 from SFDO-Community/feature/update-profile-fix
Browse files Browse the repository at this point in the history
Don't strip default from all record types
  • Loading branch information
Cameron Goodman authored Apr 29, 2020
2 parents ab6e3d1 + 5fdf636 commit 4661136
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tasks/update_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,30 @@ def _expand_package_xml(self, package_xml):
custom_objects.append(
"members",
text=f"{record['NamespacePrefix']}__{record['DeveloperName']}__c",
)
)

def _set_record_types(self, tree, api_name):
record_types = self.options.get("record_types") or []

# Set recordTypeVisibilities
for rt in record_types:
# Replace namespace prefix tokens in rt name
rt_prefixed = rt["record_type"].format(**self.namespace_prefixes)

# Look for the recordTypeVisiblities element
elem = tree.find("recordTypeVisibilities", recordType=rt_prefixed)
if elem is None:
raise TaskOptionsError(
f"Record Type {rt['record_type']} not found in retrieved {api_name}.profile"
)

# Set visible
elem.visible.text = str(rt.get("visible", "true")).lower()

# Set default
elem.default.text = str(rt.get("default", "false")).lower()

# Set person account default if element exists
pa_default = elem.find("personAccountDefault")
if pa_default is not None:
pa_default.text = str(rt.get("person_account_default", "false")).lower()

0 comments on commit 4661136

Please sign in to comment.