diff --git a/capella2polarion/elements/element.py b/capella2polarion/elements/element.py
index 58646feb..e533f8f1 100644
--- a/capella2polarion/elements/element.py
+++ b/capella2polarion/elements/element.py
@@ -271,6 +271,8 @@ def _make_url_list(
url = serialize.POLARION_WORK_ITEM_URL.format(pid=pid)
urls.append(f"
{url}")
+
+ urls.sort()
url_list = "\n".join(urls)
return f""
diff --git a/tests/test_elements.py b/tests/test_elements.py
index 5d969dec..c9ef64e8 100644
--- a/tests/test_elements.py
+++ b/tests/test_elements.py
@@ -632,6 +632,25 @@ def test_maintain_reverse_grouped_links_attributes(dummy_work_items):
assert dummy_work_items["uuid2"].additional_attributes == {}
+def test_grouped_linked_work_items_order_consistency():
+ work_item = serialize.CapellaWorkItem("id", "Dummy")
+ links = [
+ polarion_api.WorkItemLink("prim1", "id", "role1"),
+ polarion_api.WorkItemLink("prim2", "id", "role1"),
+ ]
+ element.create_grouped_back_link_fields(work_item, links)
+
+ check_sum = work_item.calculate_checksum()
+
+ links = [
+ polarion_api.WorkItemLink("prim2", "id", "role1"),
+ polarion_api.WorkItemLink("prim1", "id", "role1"),
+ ]
+ element.create_grouped_back_link_fields(work_item, links)
+
+ assert check_sum == work_item.calculate_checksum()
+
+
class TestHelpers:
@staticmethod
def test_resolve_element_type():