locked
The specified object was not found (but object exists!) Help RRS feed

  • Question

  • Hi again,

    ok I am trying to retrieve a  salesorder object with the following line of code:

    salesorder so = (salesorder)CRMS.Retrieve(EntityName.salesorder.ToString(), new Guid(hfGUID.Value), new AllColumns());

    within the application, CRMS is the web service (crm) and hfGUID contains the correct working and verified GUID of the currently active order in crm (the application is loaded through an iframe and this information is passed on the query)

    I know that the GUID is correct because I can generate an email template against it in the same code, and although useless I can set the salesorder as the recpient of the email and then view the new email in CRM, however useless this does prove that the GUID is correct.

    Any ideas why CRM will happily use the GUID such as in the following example:

     instTemplate.ObjectId = new Guid(hfGUID.Value);
     instTemplate.ObjectType = EntityName.salesorder.ToString();
     InstantiateTemplateResponse instTempResp = (InstantiateTemplateResponse) CRMS.Execute(instTemplate); 

    But returns object not found in the following context:
    salesorder so = (salesorder)CRMS.Retrieve(EntityName.salesorder.ToString(), new Guid(hfGUID.Value), new AllColumns());

    Thanks guys.

            


    Monday, August 27, 2007 9:12 AM

Answers

  • Everyone should just ignore me today!!

    The error message was not from retrieving the entity, that works fine, it was from setting the ActivityParty later on in the code

    It is Sunday!

    Monday, August 27, 2007 10:34 AM

All replies

  • As an addition the following fails with the same object not found error.

     TargetRetrieveSalesOrder targetSO = new TargetRetrieveSalesOrder();
                targetSO.EntityId = new Guid(hfGUID.Value);
                RetrieveRequest getOrder = new RetrieveRequest();
                getOrder.Target = targetSO;
                getOrder.ColumnSet = new AllColumns();
                RetrieveResponse soResponse = (RetrieveResponse)CRMS.Execute(getOrder);
                salesorder so = (salesorder)soResponse.BusinessEntity;


    I must be missing something?

    p.s.

    Even with the guid pasted into the code as a literal the call fails.  The GUID is the exact same guid seen if the order is opened in crm and then crtl+n is pressed to see the explorer address bar.

    This object 100% exists and the guid is 100% correct.

    Thanks
    Monday, August 27, 2007 10:23 AM
  • Everyone should just ignore me today!!

    The error message was not from retrieving the entity, that works fine, it was from setting the ActivityParty later on in the code

    It is Sunday!

    Monday, August 27, 2007 10:34 AM