Options

R2: Webservice PageFunction ReadByRecId problems

JanGDJanGD Member Posts: 12
edited 2011-01-14 in NAV Three Tier
Hello!

A happy new Year to all of you.

I am currently working out on a MVC project with NAV Webservices as Datasource.
I stumbled across the new function "ReadByRecId".
I tried using it with a Customer Webservice, but it always returns a null value.

i tried this
public ActionResult Details(String id)
{
  service = new Customer_Service(); 
  service.UseDefaultCredentials = true;
  cust = service.ReadByRecId(id.ToUpper()); //prevent lowercase on codefield
  var c = new NavCustomer(ref cust);
  return View(c);
}

But i always get a null on the cust variable of type Customer.
Using the Filters to get the record works neither. It seems to be related to the id.ToUpper() call, but why? I use a String of 10000 passing with this call. Why isn't it working?


Thanks in advance for your help!
Cheers,
~jan

Comments

  • Options
    EgnazEgnaz Member Posts: 111
    Hi,

    you looked into the What new paper and found "Entity ReadByRecId(string formattedRecId)". I don't know what value for "formattedRecId" is expected but maybe you can to a test and try the other new function "string GetRecIdFromKey(string key)" and look what will be returned for the key.

    Just a suggestion.

    Regards,
    Egnaz
  • Options
    dmccraedmccrae Member, Microsoft Employee Posts: 144
    The format is: "<Table>: <Key field value1,Key field value 2,...>"

    So for customer this would be:

    "Customer: CUST1"
    Dean McCrae - Senior Software Developer, NAV Server & Tools

    This posting is provided "AS IS" with no warranties, and confers no rights.
Sign In or Register to comment.