Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Import csv data in a crm online lookup field using powershell

$
0
0

Hello,

I have a powershell script which creates crm record by reading the data from .csv file however I am able to insert data in all crm entities except lookup fields.

I am getting below error when try to import data from csv file using powershell. BTW its CRM Online.

Error :- FaultException`1 - Create : si_requestsubtype |=> Invalid value type for attribute: si_requesttype of entity:
si_requestsubtype, Expected Type: lookup, Actual Type: System.String

I would need to convert string to lookup type using powershell. Any help?

My script:-

$conn = Connect-CrmOnlineDiscovery -interactiveMode

$File=Import-Csv -Path "C:\Users\Example.csv"

ForEach ( $row in $File ) {

$FileWorkflowsubType = $row.'Workflow Subtype'
$FileWorkflowType1=$row.'Workflow Type'


New-CrmRecord -conn $conn -EntityLogicalName si_requestsubtype @{"si_requestsubtype"="$FileWorkflowsubType";"si_requesttype"="$FileWorkflowType1"}


}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images