Extensible Data Security (XDS) with Dynamics 365 Finance and Operation

XDS is one of the sparkling features in Dynamics. It takes you beyond the forms achieving the ultimate data control. It is one of the key features that captivate the customer heart and mind. It is a great dramatic closing for your demos.

So for example you have Buyer who only work with selective suppliers and deals on selective items, in such data security scenarios we can use XDS Extensible Data Security.

for example on one of the demo i have created this XDS policy where i am filtering the items based on Buyer group (we can do Buyer group settings on different levels, Worker, Items, Supplier ). We are using custom security roles and policies (using XDS Framework) in this implementaion. We have created a security policy query on ECORESPRODUCT table as shown below. It filters the item based on Buyer group assigned to current logged in worker.

Then we have created the security policy and added the constraints tables, Property settings related to this security policy is shown below. Lastly we associate the role with the security policy to apply the data security/filter on that specific role. So now when we assign that custom role to any user, that user will see the filtered items.

  • Set the PrimaryTable property on the policy to EcoResProduct.
  • Set the Query property on the policy to custom query we have created above.
  • If you want the primary table to be secured using this policy, set the ConstrainedTable property to Yes.
  • Set the Enabled property to Yes or No. This property can be used to control whether the policy will be enforced by the extensible data security runtime.

Setting the context

Set the ContextType property to one of the following:

  •  ContextString – Set the property to this value if a global context is to be used to determine whether the policy should be applied. When required, this context string needs to be set by the application using the XDS::SetContext API.
  • RoleName – Set the property to this value if the policy should be applied only if a user in a specific role accesses the constrained tables.
  •  RoleProperty – Set the property to this value if the policy is to be applied only if the user is a member of any one of a set of roles that have the ContextString property set to the same value.

 

When adding a constrained table, you must also choose the relationship to be used to join the primary table with this constrained table.

Now build , synchronize the AOT Query and Security policy, Refresh browser and open Released product form.

Thank you for reading

Happy Daxing 🙂

Advertisements

D365FO Financial reports (Management reports) error “The Operation could not be completed because the item no longer exists.”

Hi Guy – i hope you are doing great,

Today i am sharing my experience on one of the problem i have faced recently on Financial reports in D365FO, when we edit the report it opens the designer and shown this error “The Operation could not be completed because the item no longer exists.”

This environment we have created by replicating the data and code based from another environment and after that cloning work all components are working fine except this Financial report thing.

After some research and through search i came to know that we have to refresh the data mart to solve this problem.

These steps are for a sandbox/UAT environment. If you need to reset the data mart in your production environment, contact support.

To rebuild the data mart using the steps found here:

https://mix.office.com/watch/36g9prxvg885

The basic steps are as follows:

  1. Run PowerShell as Administrator.
  2. Browse to .\MRInstallDirectory.

    For a demo or DEV deployment, this will typically be J:\MROneBox\MRInstallDirectory

    For Production or HA deployments, this will typically be J:\MRProcessService\MRInstallDirectory for the BI machine and F:\MRApplicationService\MRInstallDirectory for the AOS.

  3. In the PowerShell window type the following command to import the MRDeploy.psd1 module: Import-Module .\Server\MRDeploy\MRDeploy.psd1
  4. You can then run the following command to reset the data mart:

    Reset-DatamartIntegration -Reason OTHER -ReasonDetail “Testing reset”

  5. Stop MR Process Service.
  6. Answer Yes when prompted in PowerShell to continue.
  7. Start MR Process Service.

 

 

AX 2012 Call Restful API using basic authentication X++ Dynamics AX 2012

Below code helps you to call the Restful API using basic authentication method of adding Authorization header using HTTP Post method.

 static void ConsumingRestService(Args _args)  
 {  
   str destinationUrl = 'Json Url here', requestXml, responseXml;  
   System.Net.HttpWebRequest    request;  
   System.Net.HttpWebResponse   response;  
   CLRObject            clrObj;  
   System.Byte[]          bytes;  
   System.Text.Encoding      utf8;  
   System.IO.Stream        requestStream, responseStream;  
   System.IO.StreamReader     streamReader;  
   System.Exception        ex;  
   System.Net.WebHeaderCollection httpHeader;  
   str               byteStr;  
   System.Byte[]          byteArray;  
   System.IO.Stream        stream;  
   System.IO.Stream        dataStream;  
   byteStr = strfmt('%1:%2', "USERNAME", "PASSWORD");  
   requestXml = " { \"storeId\": 25001, \"terminalId\":\"012\", \"transactionSequenceNumber\":\"031949640279\", \"lookup\" : { \"nameSearch\" : { \"lastName\" : \"Jones\",\"zipCode\" : \"214034702\" } } }";  
   try  
   {  
     new InteropPermission(InteropKind::ClrInterop).assert();  
     httpHeader = new System.Net.WebHeaderCollection();  
     clrObj = System.Net.WebRequest::Create(destinationUrl);  
     request = clrObj;  
     utf8 = System.Text.Encoding::get_UTF8();  
     bytes = utf8.GetBytes(requestXml);  
     request.set_KeepAlive(true);  
     request.set_ContentType("application/xml");  
     utf8    = System.Text.Encoding::get_UTF8();  
     byteArray  = utf8.GetBytes(byteStr);  
     byteStr   = System.Convert::ToBase64String(byteArray);  
     httpHeader.Add("Authorization", 'Basic ' + byteStr);  
     request.set_ContentType("text/xml; encoding='utf-8'");  
     request.set_ContentLength(bytes.get_Length());  
     request.set_Method("POST");  
     request.set_Headers(httpHeader);  
     requestStream = request.GetRequestStream();  
     requestStream.Write(bytes, 0, bytes.get_Length());  
     response = request.GetResponse();  
     responseStream = response.GetResponseStream();  
     streamReader = new System.IO.StreamReader(responseStream);  
     responseXml = streamReader.ReadToEnd();  
     info(responseXml);  
   }  
   catch (Exception::CLRError)  
   {  
     //bp deviation documented  
     ex = CLRInterop::getLastException().GetBaseException();  
     error(ex.get_Message());  
   }  
   requestStream.Close();  
   streamReader.Close();  
   responseStream.Close();  
   response.Close();  
 }  

Thanks for reading the blog
Happy daxing 🙂

Dynamics ax 2012 : AxBuild.exe xppcompileall stuck on 3 asterisks

Recently with one of the customer i faced this issue, Each time the compile starts, it just shows the AxBuild prompt with 3 asterisks and the window closes after about 15-20 minutes (without actually doing anything).

Event i have run the command as Admin but nothing worked and faced same problem

axbuild.exe  xppcompileall  /s=01 /altbin=”C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin”

After enough research i came to know that this is possible in two scenarios. The first one is the permissions, ensure the user running axbuild.exe has the same permissions as the AOS Service account and account should have enough access on AX database also. For me this was the problem the account through which i am login to system does not have enough permission to AX database.

AxBuild.exe must be run by an account that has no less security authority than the account that runs the permanent AOS has.

Source: https://msdn.microsoft.com/en-us/library/dn528954.aspx

The second time, it happened when the SQL Server had no more RAM resources available. Then fix would be to clear memory for SQL service.

Thanks for reading

Happy daxing 🙂

Amir

 

%d bloggers like this: