Finding regardingobjectid's type name in the plugin RRS feed

  • Question

  • Hi All,

    I am writing a plugin(crm2011) on Email entity. Once email entity status becomes sent and regardingobjectid (Entity type) is 'account', i want to create a one task record. How can i check in the plugin regardingobjectid is a type of account? 

    Kindly let me know. Thans in advance.


    Friday, July 5, 2013 9:06 AM

All replies

  • Hi,

    You can check it like below

     objEmail = ((Entity)context.InputParameters[ParameterName.TARGET]).ToEntity<Entities.Email>();
       if (objEmail != null && objEmail.RegardingObjectId != null )
        if(objEmail.RegardingObjectId.LogicalName == "account")
    	  // It is an Account

    Hope it helps,


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Mohammad Yusuf Ansari http://microxrm.blogspot.in

    Friday, July 5, 2013 9:51 AM
  • There is no way to retrive the name vlaue of the lookup as we do in client sidescripting in plugins. You should retreive the values of attributes of lookup entity by Id and than get the name/title/fullname field value.



    • Edited by Faisal Fiaz Friday, July 5, 2013 10:14 AM okok
    • Proposed as answer by Faisal Fiaz Friday, July 5, 2013 10:14 AM
    Friday, July 5, 2013 10:08 AM
  • I don't want lookup name value. if regarding object id contains data then i need to know whether regarding object is an account or contact.
    Friday, July 5, 2013 10:48 AM