locked
How to get guid for custom entity RRS feed

  • Question

  • How to get the guid of the custom entity?

    Here is the code:

    DynamicEntity entity = new DynamicEntity("new_ira_stavke");
                    entity["new_name"] = stavkelst[i].art;
                    entity["new_cijena"] = stavkelst[i].ukupno;
    
                    QueryExpression query = new QueryExpression(entity.Name);
                    query.ColumnSet = new AllColumns();
                    query.Criteria.AddCondition("god", ConditionOperator.Equal, tmp.First().god);
    
                    BusinessEntityCollection bec = service.RetrieveMultiple(query);
                    if (bec.BusinessEntities.Count != 0)
                    {
                        DynamicEntity bentity = (DynamicEntity)bec.BusinessEntities.First();
    
                        entity["new_account2iraid"] = new Lookup("new_ira", how to get Guid for bentity?);
                    }
    
                    Guid entityid = service.Create(entity);
    Wednesday, October 7, 2009 11:17 AM

Answers

  • Hi.

    Try to use following code:

    entity["new_account2iraid"] = new Lookup("new_ira", ((Key)bentity[bentity.Name + "id"]).Value);

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    • Marked as answer by bivanise Tuesday, October 13, 2009 11:10 AM
    Wednesday, October 7, 2009 11:23 AM
    Moderator