locked
How to assign to different user in custom entity? RRS feed

  • Question

  • Hello all,

    I want to assign to another user in my custom entity, i apply a owner class, but always not success to assign different user.

    from SDK i use this code:

    Owner owner = new Owner();
    owner.type = EntityName.systemuser.ToString();
    owner.Value = user.UserId;
    Other things in sales order i can use, 

    TargetOwnedSalesOrder, always sucessfull with this class.

    Have suggestion?

    thanks Glo. 

    Thursday, July 9, 2009 2:15 AM

Answers

  • Hi,

    For your custom entity you could use TargetOwnedDynamic class.

         SecurityPrincipal assignee = new SecurityPrincipal();
                assignee.PrincipalId = new Guid(owneridGuid);
    
                TargetOwnedDynamic targetAssign = new TargetOwnedDynamic();
                targetAssign.EntityId = new Guid(entityGuid);
                targetAssign.EntityName = "customEntityName";
    
                AssignRequest assign = new AssignRequest();
                assign.Assignee = assignee;
    
                AssignResponse assignResponse = (AssignResponse)service.Execute(assign);
             



    Regards,
    Nishant Rana
    http://nishantrana.wordpress.com
    Thursday, July 9, 2009 5:16 AM

All replies

  • Hi,

    For your custom entity you could use TargetOwnedDynamic class.

         SecurityPrincipal assignee = new SecurityPrincipal();
                assignee.PrincipalId = new Guid(owneridGuid);
    
                TargetOwnedDynamic targetAssign = new TargetOwnedDynamic();
                targetAssign.EntityId = new Guid(entityGuid);
                targetAssign.EntityName = "customEntityName";
    
                AssignRequest assign = new AssignRequest();
                assign.Assignee = assignee;
    
                AssignResponse assignResponse = (AssignResponse)service.Execute(assign);
             



    Regards,
    Nishant Rana
    http://nishantrana.wordpress.com
    Thursday, July 9, 2009 5:16 AM
  • Hi,

    thank you very much, it very helpful.

    Regards,

    Glo.
    Monday, July 13, 2009 2:15 AM