Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Import csv data in a crm online lookup field using powershell

(1) ShareShare
ReportReport
Posted on by 7

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"}


}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans