Wednesday, November 5, 2014

Create APP Developer Site


Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"}


  $account = Get-SPManagedAccount "Eli\spsvc"


  $appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
  $appPoolAppSvc = New-SPServiceApplicationPool -Name AppServiceAppPool -Account $account


  $appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName SettingsServiceDB
  $proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc

  $appAppSvc = New-SPAppManagementServiceApplication –ApplicationPool $appPoolAppSvc –Name AppServiceApp –DatabaseName AppServiceDB
  $proxyAppSvc = New-SPAppManagementServiceApplicationProxy –ServiceApplication $appAppSvc



Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false

Monday, October 27, 2014

Add New User

Find SID from regedit, under HKEY_USERS. Copy the SID as your own machine's SID.

Update userinfo table as the following:
update userinfo set SID='', Networkdomain = '<Network_domain_name>', networkalias = '<Network_alias>' where id = 'admin'


Excerpt from other blog:
Prepare the Database-Create a new database in SQL and restore the backup from the customer into it.
-In SQL in the newly restored database go to Security > Users.  Right-click on Users and choose new user.  Add the user account that runs the AOS service.  For me, this is my domain account. 
-In the middle of this user form, under Owned Schemas mark db_owner.
-Still in the same form where you added the user, under Database role membership mark db_datareader, db_datawriter, and db_owner.
-In SQL in the newly restored database go to Programmability > Stored Procedures and right-click on CreateServerSessions and choose Properties.
-Click Permissions and click the Search button.  Find the account you just added to the database as a user, for me this is my domain account.
-In the bottom of this form under the Grant column mark all of the choices.
-In SQL in the newly restored database go to Programmability > Stored Procedures and right-click on CreateUserSessions and choose Properties.
-Click Permissions and click the Search button.  Find the account you just added to the database as a user, for me this is my domain account.
-In the bottom of this form under the Grant column mark all of the choices.
-In SQL click the New Query button.
-Choose your EXISTING AX database - so not the customer's database you just restored but the AX database you have with demo data in it, run the following query:
 select SID, NETWORKDOMAIN, NETWORKALIAS, * from UserInfo where Id = 'Admin'
-Click the New Query button and choose the CUSTOMER's database.  Leave your existing query against your own database open.  We are going to use the results in our next query.
-In the New Query against the customer's database run the following:
update USERINFO set SID = 'SID field from previous query', NETWORKDOMAIN = 'NETWORKDOMAIN field from previous query', NETWORKALIAS = 'NETWORKALIAS field from previous query'
 where ID = 'Admin' --The idea here is you want to grab the SID, NETWORKDOMAIN and NETWORKALIAS values from your own UserInfo table and update the customer's UserInfo table with your user information so you can log into their database.

Saturday, October 25, 2014

Restore DB


1.Shutdown the AOS in services
2.Open SQL Management Studio
3.Connect to the SQL Database
4.Right Click MicrosoftDynamicsAx => Tasks => Restore => Database
5.Select From Device and then find the downloaded .bak File.
6.On the top left click on "Options" and check the first box: Overwrite the existing database (With REPLACE)
7.Click OK and repeat for the other DB.
Repeat same for the Model database.

Tuesday, October 14, 2014

UserSessionService

Steps to remove fix it
1. Go to directory: C:\Program Files\Microsoft Dynamics AX\60\Server\OE_US_AX_TST\bin
2. Stop AX Service
3. Make a copy of XPPIL folder
4. Delete XPPIL folder
5. Start AX Service
6. Generate Full CIL

Monday, October 6, 2014

Mailer Program

    SysMailer                           mailer;  
    SysEmailParameters                  params;
   
    ;
   
    // Set up the email header
    mailer = new SysMailer();
    mailer.subject("TEST EQ");
    mailer.fromAddress("abc@abc.com");
   
    params = SysEmailParameters::find();
    mailer.SMTPRelayServer(params.SMTPRelayServerName,
                           params.SMTPPortNumber,
                           params.SMTPUserName,
                           sysEmailParameters::password());

    mailer.tos().appendAddress("abc@abc.com");
    mailer.body("Some body message");
   
    // Send the email
    startlengthyoperation();

    mailer.sendMail();

    endlengthyoperation();

Wednesday, August 20, 2014

Compare Datetime

    mbsWMSPODDeliveryTable mbsWMSPODDeliveryTable;
    utcdatetime xppDttm;
    System.DateTime    nppDttm;
    TransDate   d;
    ;
    xppDttm = 2013-10-05T23:22:21; // ISO standard format.
    nppDttm =  Global::utcDateTime2SystemDateTime( xppDttm);
    while select crosscompany SignatureName
        from mbsWMSPODDeliveryTable
            where mbsWMSPODDeliveryTable.DeliveryDateTime > xppDttm
               
    {
    if(strScan(mbsWMSPODDeliveryTable.SignatureName, "Laing", 1, strLen(mbsWMSPODDeliveryTable.SignatureName)))
        info(mbsWMSPODDeliveryTable.SignatureName);
    }

Tuesday, August 19, 2014

CommaIo object not initialized

"CommaIo object not initialized" was indeed file-related but in a more broad
sense.

The code was correct. The file path and name were correct. Backslashes were
escaped. The calls, the setup, everything was correct, except...

When a new Class is created the RunOn property is set to "Called from" by
default. Changing that to "Client" fixes the problem.