web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

NAV 2013 Web Services for User Card error

(0) ShareShare
ReportReport
Posted on by 270

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?

*This post is locked for comments

I have the same question (0)
  • Jens Glathe Profile Picture
    6,092 on at

    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

    Jens

  • Aleksandar Totovic Profile Picture
    16,765 on at

    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.

  • nboettcher Profile Picture
    270 on at

    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.

  • nboettcher Profile Picture
    270 on at

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

  • Suggested answer
    Aleksandar Totovic Profile Picture
    16,765 on at

    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.

  • Suggested answer
    Jens Glathe Profile Picture
    6,092 on at

    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

  • nboettcher Profile Picture
    270 on at

    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);

    -Nate

  • Suggested answer
    Jens Glathe Profile Picture
    6,092 on at

    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

    Jens

  • nboettcher Profile Picture
    270 on at

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

  • Suggested answer
    Jens Glathe Profile Picture
    6,092 on at

    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

    Jens

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans