Enter the key words to find the related topics

Showing posts with label ax2012. Show all posts
Showing posts with label ax2012. Show all posts

Added AX user using the command in AX 2012

 

You can replace the admin user’s SID field with yours and you can log in afterward.

 To get your SID open a cmd and run this:

Whoami /all

 Then scroll back to the top and you should see something like this:

C:\Users\xyz>whoami/all

 

USER INFORMATION

----------------

 

User Name SID

========= ============================================

test\xyz   S-1-5-21-123456789-xxxxxxxxx-xxxxx-xxxx

 

Grab the SID and put it in this SQL update script, replace the DB name,  name and network alias (and maybe the domain too, not sure about that) and run it on the data database

 

UPDATE [AXLocal].[dbo].[USERINFO]

SET SID = 'S-1-5-21-123456789-xxxxxxxxx-xxxxx-xxxx',

NETWORKDOMAIN = 'test.xyzit.com',

NETWORKALIAS = 'xyz',

NAME = 'xyz',

SHOWAOTLAYER = 1,

SHOWMODELNAMEINAOT = 1

where ID = 'Admin'

Dynamic query to fetch unique data.

I am using InventSite table to fetch unique SiteId and Name fields.


  1. Query                                              query;
  2. QueryBuildDataSource                   qbds;
  3. QueryRun                                         qr;
  4. InventSite                                         inventSite;
  5.  
  6. query      =  new Query();
  7. qbds       =  query.addDatasource(tablenum(InventSite));
  8. qbds.addGroupByField(fieldnum(InventSite, SiteId));
  9. qbds.addGroupByField(fieldnum(InventSite, Name));
  10.  
  11. while(qr.next())
  12. {
  13.         inventSite   =  qr.get(tablenum(InventSite));
  14.         info(strfmt("SiteId  : %1,  Name  : %2", inventSite.SiteId, inventSite.Name));
  15. }


Note: If I comment Step-9, in the result we wont get Name details