Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Unable to Fetch User Lookup id during data import in Plugin

Posted on by Microsoft Employee

Hi Experts,

I am importing Sales Geography Entity data through Data import wizard in Dynamics 365.

I registered a Plugin on Pre Operation Create which will fetch the "User Lookup id" from "Primary responsible Lookup field" during Data import and create a Team and assign the respective team to Sales Geography Entity record.

I have given the User Full name in "Primary responsible Lookup field" in Data import excel sheet. During data import I am not getting the respective GUID of the user in Pre Operation Plugin and so team is not getting created and assigned due to Team Creation failed due to empty primary responsible.

If I create the same record manually then there is no issue - Pre Operation Plugin triggers and Team is getting created and assigned successfully.

I have changed the Pre-Operation to Post-Operation and given Admin level Privilege to the respective Primary responsible user but also getting null value from Primary responsible Lookup field

Regards,

Vignesh Babu

*This post is locked for comments

  • Suggested answer
    Syed Ibrahim Profile Picture
    Syed Ibrahim 6,257 on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Hi vignesh,

    If you are using the below condition in your plugin

    if(context.Depth = 1) then change this to

    if(context.Depth <= 2) because while import the depth with be 2 so it wont triggered your plugin .

    Hope this helps

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Hi Aric,

    I tested with Sys admin role also. But issue remains the same.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Hi Vignesh,

    this is another problem probably caused by your plugin logic.

    Never seen "Team Creation failed due to empty primary responsible" error, maybe you put some logic into plugin to check for "primary responsible"?

    In this case you need to create the team passing this value to it, like

    Entity newteam = new Entity("team");
    
    newteam["name"] = ...;
    
    newteam["businessunitid"] = ...;
    newteam["new_primaryresponsibleid"] = *** record from import Fullname ***;
    service.Create(newteam);

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Can you check that your team actually has permissions/security role on that user record. They should have at least Read Only access in order to be able to create the records and set them as the owner of the record.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Hi Arpit,

    Thanks for the answer. I am giving User Full name in the excel sheet and mapping with User full name field in data mapping correctly.

    User full name value is getting set without any issue but in Plugin am getting null value for the respective User Lookup id.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Hi Franchesco,

    Thanks for the answer. I registered the Plugin in asynchronous execution mode and on post operation stage. Record is getting saved with User Full name which I am giving in the excel sheet but Team record is not created in my Plugin due to an error "Team Creation failed due to empty primary responsible". still I am getting an null value from Primary responsible GUID.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Hi Vignesh ,

    imported records are assigned by default to user who made the import when record import ends.

    You need to use Post Operation Stage and Asynchronous Execution Mode: this way, after record had been assigned to import user, plugin come later to assign it to the right owner.

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Unable to Fetch User Lookup id during data import in Plugin

    Hi Vignesh,

    Make sure, you are doing the correct mapping of user lookup field in Data Import wizard while importing records.

    See below link for more info:

    https://www.powerobjects.com/2011/12/15/importing-lookup-values-using-crm-2011-data-import-wizard/

    Cheers

    Arpit

    arpitmscrmhunt.blogspot.in

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans