May 01, 2019

'RunAs' method in Dynamics 365 FO

Hi Folks,

Most of us have used RunAs earlier and it has the same use in D365Fo as well. Sometimes we came across where we need to run a specific business operation under a different user account than the currently logged-in user. To achieve this we can use RunAs to execute a specific operation. This enables the caller to run an X++ method in the security context of another user. This function is most often used with batch processing or workflow submission for another user.

The syntax is really simple as below,

container runAs(
        str userId,
        int classId,
        str staticMethodName
        [,
        container params,
        str company,
        str language,
        str partition
        ])

Parameter
Description
userId
The user to impersonate.
classId
The class to invoke in the impersonated session.
staticMethodName
The class method to invoke in the new user context.
params
The parameters to pass to the method; optional. 
company
The company that is selected for the impersonated session; optional.
language
The language that is selected for the impersonated session; optional.
partition
The partition key of the type that is returned by the getCurrentPartitionfunction; optional.

Now, let's see how to implement it and take an example of submitting a PR for a different user.

I need to submit a Purchase requisition on behalf of the different user through X++ code. To get this done I need a few details all in a single container type parameter



Hope it will help.

Cheers!!!
-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

April 26, 2019

QuickFix-2: Export up to 1 million rows to Excel

The Export to Excel feature can now be configured to allow users to export up to 1 million rows from a grid in Finance and Operations, a substantial increase from the previous 10,000-row limit. By default, the export limit is set to 50,000 rows, but through the Client performance options page, system administrators can adjust the export limit as high as 1 million rows.

Check below link

https://docs.microsoft.com/en-us/business-applications-release-notes/october18/dynamics365-finance-operations/export-more-row

-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

April 17, 2019

[Updated] How to set new admin user post DB refresh

[Last updated on Feb 24, 2022]

Hi Folks,

Many times we need to get actual data for our development and to get such data in your dev box you need to restore data from either UAT/QA/SIT or any environment which has such data.
Once you complete DB restore in your target system, here issues come, you don't have admin access or maybe SysUser access to this new DB.
Microsoft provides a script to update your email id as admin in your dev box. Follow the below steps to achieve this.

Step 1: Go to your DEV box RDP.

Step 2: Go to below path K:\AosService\PackagesLocalDirectory\Bin (In most cases it will be the same as mentioned if you didn’t find search for ‘PackagesLocalDirectory’ or ‘Packages’ shortcut in one of the drives.

Step 3: Open ‘AdminUserProvisioning’
















Step 4: Enter your email Id, which you want to give admin access to this environment, and click on the submit button.

















Step 5: Here you go.

















the other option is using scripts,

Step1: Run below script on old DataBase


select SID, NETWORKDOMAIN, NETWORKALIAS, * from UserInfo where Id = ‘Admin’

 make a note of all these values.

Step 2: Run below script on new Database

update userinfo
set
networkdomain = ‘YourDomainName’,
networkalias = ‘Administrator’,
SID = ‘SID’

where ID = ‘Admin’




For more details pl check this link


Cheers

Harry
Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

March 05, 2019

QuickFix-1: Delete transaction data in D365FO

To delete all transaction data in a D365 FO environment, use below browser URL. Replace the values with your details and open.

https://<Environment Link>/?mi=SysClassRunner&cls=SysDatabaseTransDelete&cmp=<LegalEntity>


-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta