Setting null for single-valued navigation property using Xrm.WebApi

后端 未结 4 1500
忘掉有多难
忘掉有多难 2021-01-14 23:34

We are in the process of remediation, re-engineering old JS web resources for latest D365 v9 sdk changes w.r.t Client scripting API improvements & deprecation.

W

4条回答
  •  攒了一身酷
    2021-01-15 00:14

    To set null on the lookup use:

    var data = { _[LookupFieldName]_value : null } 
    Xrm.WebApi.updateRecord("abc_entity", abc_entityid, data).then(successCallback, errorCallback
    

    For example to remove contact.parentcustomerid field value you need to use:

    var data = {};
    data._parentcustomerid_value = null
    var t = await Xrm.WebApi.updateRecord("contact", "{0200E6F5-1D21-E811-A954-0022480042B3}", data)
    

提交回复
热议问题