locked
Plugin is not firing for export? RRS feed

  • Question

  • Hi,

    I want to export for Entity User. I have a plugin  for same entity. Its for PreOperation(Create).

    I am expecting that the plugin should fire at the time import user(by import it will create one one record).

    But plugin is not executing and and showing a error ISV code aborted the operation.

    Please help me to find out the solution.

    thanks

    Sangram Keshari Biswal.


    microsoft blog

    Wednesday, February 5, 2014 9:04 AM

All replies

  • Please paste your code.

    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful" Thank you, DT

    Wednesday, February 5, 2014 9:08 AM
  • This code i am using for Precreate Operation.

       if (context.InputParameters.Contains("Target"))
                {
                    Entity User = (Entity)context.InputParameters["Target"];


                    Guid UserId = User.Id;

                    EntityReference parentuserid = new EntityReference("systemuser", new Guid((String)User["parentsystemuserid"]));

                    //retrieve user record
                    ColumnSet allFields = new ColumnSet() { AllColumns = true };
                    Entity user = _service.Retrieve("systemuser", parentuserid .Id, allFields);

                    //get business unit lookup
                    Guid businessUnitId = ((EntityReference)user.Attributes["businessunitid"]).Id;
                    User.Attributes["businessunitid"] = businessUnitId;

                }

    Thanks

    Sangram Keshari Biswal.


    microsoft blog

    Wednesday, February 5, 2014 9:25 AM
  • Hi Sangram,

    I found a problem in your code,

    EntityReference parentuserid = new EntityReference("systemuser", new Guid((String)User["parentsystemuserid"]));

    Here parentsystemuserid is a lookup.

    So try using,

    ((EntityReference)User["parentsystemuserid"]).Id instead of new Guid((String)User["parentsystemuserid"]) Also please use contains in your codes.


    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful" Thank you, DT


    Wednesday, February 5, 2014 9:38 AM
  • hiii, 

    the problem is that plugin itself is not firing for export operation. once it will start firing, then i can handle easily.

    Thanks


    microsoft blog


    • Edited by Sangram.kb Wednesday, February 5, 2014 10:46 AM
    Wednesday, February 5, 2014 10:45 AM