Skip to main content
Solved

unable to update lookup column in dynamic crm 365 with cdata python connector

  • July 22, 2025
  • 3 replies
  • 74 views

Forum|alt.badge.img


import cdata.dynamics365 as mod

conn_str = (
    'OrganizationUrl=https://dddddd.crm4.dynamics.com;'
    "OAuthSettingsLocation=/home/ddddddv.txt;"
    'InitiateOAuth=REFRESH;'
    'Edition=Sales;'
    'IncludeLookUpLogicalName = true;'
)


conn = mod.connect(conn_str)
try:
    cursor = conn.cursor()
    cursor.execute("""
       UPDATE table1 
        SET colum1 = 'sdsdds0299e3' 
        WHERE A = 110 AND B = 0
    """)

    # Get column names from description
    columns = [col[0] for col in cursor.description]
    print("Columns in gfwi_projects:")
    for col in columns:
        print(col)

finally:
    cursor.close()
    conn.close()

column 1 is a lookup column which refers to column 2 of table 2. when i run the python query. there is an error : column1 could not be updated. This column is read-only. please help

Best answer by Ethem Q

Hi ​@phuvi2132 

First, to find out if the fields are read-only or not in the IsReadOnly field you can run a SELECT * FROM sys_tablecolumns WHERE TableName = 'TableName'.

In regards to the update failing for lookup columns that is because typically Lookup properties are computed, read-only properties that have an Edm.Guid value. Lookup properties make use of the following naming convention: _<name>_value. Can you confirm if that is the case with the column you are trying to update?

To change the value of a lookup property, you must change the single-valued navigation property that it represents. Kindly check the following documentation for more information: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/web-api-navigation-properties#lookup-properties 

By default, navigation properties are not included in the list of columns. To retrieve the list of navigation properties, set IncludeNavigationProperties=true in the connection string. Kindly refer to the following documentation for more details on this property: https://cdn.cdata.com/help/LJK/py/RSBDynamics365_p_IncludeNavigationProperties.htm 

Note that you may see the _columnname_value query example in the above documentation, but this seems to be outdated. Therefore in your insert/update statement you should use the Single-valued navigation property <name>instead of the Lookup field _<name>_value. 

If you keep having issues with this I recommend reaching out to the CData support team ([email protected]) with more details and one of our support specialists will further assist you.

This topic has been closed for replies.

3 replies

PratikV
Forum|alt.badge.img
  • Employee
  • July 23, 2025

@phuvi2132 ,

Thank you for reaching out to us.

As per the error message, it appears that the column you're attempting to update is read-only, which is why you're encountering this issue. Could you please verify whether the column is indeed set as read-only?

Additionally, we noticed that you've enabled the IncludeLookUpLogicalName property. When this property is enabled, any lookup logical name fields should appear with the _lookuplogicalname suffix. However, this suffix doesn't seem to be present in the current output.
https://cdn.cdata.com/help/LJK/py/RSBDynamics365_p_IncludeLookUpLogicalName.htm

For further assistance, we recommend reaching out via email to [email protected]. This will allow us to gather the necessary details and provide more targeted support to help resolve the issue effectively.


Forum|alt.badge.img
  • Author
  • Apprentice
  • July 23, 2025

HI ​@PratikV ,

 

Thankyou for the respond, i checked , the lookup columns doesnt have any read-only setting. that’s typical lookup column in crm dynamic 365. 
do you have any example with the update for the lookup column ?
i dont understand what should i do with this “any lookup logical name fields should appear with the _lookuplogicalname suffix”


Ethem Q
Forum|alt.badge.img
  • Employee
  • Answer
  • July 24, 2025

Hi ​@phuvi2132 

First, to find out if the fields are read-only or not in the IsReadOnly field you can run a SELECT * FROM sys_tablecolumns WHERE TableName = 'TableName'.

In regards to the update failing for lookup columns that is because typically Lookup properties are computed, read-only properties that have an Edm.Guid value. Lookup properties make use of the following naming convention: _<name>_value. Can you confirm if that is the case with the column you are trying to update?

To change the value of a lookup property, you must change the single-valued navigation property that it represents. Kindly check the following documentation for more information: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/web-api-navigation-properties#lookup-properties 

By default, navigation properties are not included in the list of columns. To retrieve the list of navigation properties, set IncludeNavigationProperties=true in the connection string. Kindly refer to the following documentation for more details on this property: https://cdn.cdata.com/help/LJK/py/RSBDynamics365_p_IncludeNavigationProperties.htm 

Note that you may see the _columnname_value query example in the above documentation, but this seems to be outdated. Therefore in your insert/update statement you should use the Single-valued navigation property <name>instead of the Lookup field _<name>_value. 

If you keep having issues with this I recommend reaching out to the CData support team ([email protected]) with more details and one of our support specialists will further assist you.