Loading Data from Dynamics CRM to SQL Server

好久不见. 提交于 2020-08-09 08:01:08

问题


Not able to get optionset string from Dynamics CRM to SQL Server using Azure data factory.

I am using Azure data factory to move data from Dynamics CRM to SQL DB. I used fetchXML query to get the data from source (CRM). I am able to get normal string and guid type values without any issue.

But the optionset field from CRM is coming as Int32 type (ie, I am getting the value of optionset, not the string).

How can I fix this issue?


回答1:


Probably you are using this approach to get the fetchxml resultset as Dynamics source to dumping into SQL using Azure Data factory. The problem you are facing is unable to consume the formatted text value for that picklist option.

We will do consume the formatted value using below syntax in code: Reference

//Option set
var industrycodeValue = accountDetails['industrycode'];

var industrycodeTextValue = accountDetails['industrycode@OData.Community.Display.V1.FormattedValue'];

If you cannot do such thing, then it’s better to dump another table in your SQL called stringmap which will store all the picklist options across the system.

Then you can inner join both tables to get the necessary data.

select INC.TicketNumber[Case ID],SMT.Value[Status Name], SMT.AttributeValue[Status Value]
from incident as INC inner join StringMap as SMT
on INC.StatusCode = SMT.AttributeValue
where SMT.AttributeName='statuscode' and SMT.ObjectTypeCode=112

Read more



来源:https://stackoverflow.com/questions/55536422/loading-data-from-dynamics-crm-to-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!