NAV 2013 Web Services for User Card error

This question has suggested answer(s)

I am trying to use Web Services in NAV to access the User Card page. I have succesfully set up the Web Service and have been able to call it from my application. I can read users, update users and delete users...however, when i try to use the .Create(ref newUser) method I get an error and can't figure out how to create a new user.

Here is the error:

User Name must have a value in User: User Security ID={6A9F7C77-13D6-43CA-A9F9-FDE1498584E7}. It cannot be zero or empty.

It doesn't matter what values I set in the User, including User_Name...I always get this message.

Any advice?

All Replies
  • Hi,

    looks a little like you need "special rights" for this. We had a similar problem with our WebService updating the windows login table. We solved it using the server-side roles "public" and "securityadmin" for this SQL Server user. Additionally, it has the db_securityadmin role for the database. This solved the issue. It's on NAV2009R2, though, but maybe a hint.

    with best regards


  • Did you try this in NAV2009? In NAV2009 you can use only domain users. When you put user ID in table, you need put user SID also.

  • I have not tried in NAV 2009...only concerned with 2013 right now.

    I am trying to insert a record into the User table...providing the User Name, Windows Security ID and Windows User Name.

    It appears it is creating a unique GUID for the Security ID column which is shown in the error message, but not taking the rest of my fields.

  • I granted the user those permissions in SQL, but that did not help...

  • User Security ID value is generated automatically and Windows Security ID is relevant for Windows authentication. I am not sure that you can create user using webservice.

  • Hi,

    sounds strange though. Using a page type webservice sounds like the way to go for me... The security ID doesn't seem to be the problem (it already has a value), more like User Name must be filled in, too. I'd say its worth a try.

    And after having a peek into Page 9807, I'd say OnInsertRecord() is the culprit:

    OnInsertRecord(BelowxRec : Boolean) : Boolean
    "User Security ID" := CREATEGUID;
    TESTFIELD("User Name");

    with best regards


  • Jens,

    thanks for replying back. I am setting the User_Name field and still getting the same error.

    Here is my code:

               FastpathConfigAD_User_Service service = new FastpathConfigAD_User_Service();

               service.UseDefaultCredentials = true;

               FastpathConfigAD_User newUser = new FastpathConfigAD_User();

               newUser.User_Name = "FASTPATH\\FMC";

               newUser.Windows_User_Name = "FASTPATH\\FMC";

               newUser.Windows_Security_ID = "S-1-5-21-2447137669-2588019272-987734687-3213";

               newUser.Full_Name = "Fran McCaffery";

               service.Create(ref newUser);


  • Hi Nate,

    I have entered a test user, and had a look at the table:

    The windows user name is not there, only the Windows Security ID. As far as I know, the page fields are validated in the display order of the page. Question: did you just publish the User Card or have you created your own page? I would suggest to create your own page.

    If all this is too cumbersome, the other way to go would be to create your own codeunit and xmlport for a webservice. I'm not sure which way I would go, after a few tries with the page I would say "then the other method". ;-)

    with best regards


  • I published the User Card as the Web Service, I have not created anything custom yet.

  • Hi,

    well then it's a good idea to create your own page for the web service. I would only put the fields you need there. A page web service doesn't care about visibility of fields, only the order is important, as it's validated in that order. To get the full functionality, you would also need to enter a password (for username/password authentication). You can add the user property table as a page part (you need an own page for this) in your page.

    With the User Card page as it's designed I'm afraid it's pretty complicated to get the webservice call right.

    with best regards