Quantcast
Channel: Martin Dráb's Activities
Viewing all 17532 articles
Browse latest View live

How to encode Tag-Length-Value (TLV) string into base64

$
0
0

Hi Daxers,

For those who don't know what TLV is:

Type/Tag-Length-Value (TLV) is an encoding scheme used in many communication protocols to encode data. A TLV-encoded message has a defined structure that consists of 3 sections/parts. Those are:
● Code of the message type (T) - 1 Byte fixed sizes of 1 byte (2 digits)
● Message value length (L) - 1 Byte fixed sizes of 1 byte (2 digits)
● Message value itself. (V) - Variable (variable size) includes the result of encoding the text string into hexadecimal

The coming example shows a string of TLV and the required result of encoding it into base64:

Example of a TLV:

0115 42 6f 62 73 20 42 61 73 65 6d 65 6e 74 20 52 65 63 6f 72 64 73 020f 31 30 30 30 32 35 39 30 36 37 30 30 30 30 33 0314 32 30 32 32 2d 30 34 2d 32 35 54 31 35 3a 33 30 3a 30 30 5a 040a 32 31 30 30 31 30 30 2e 39 39 0509 33 31 35 30 31 35 2e 31 35

Encode this to a Base64 must represent:

ARVCb2JzIEJhc2VtZW50IFJlY29yZHMCDzEwMDAyNTkwNjcwMDAwMwMUMjAyMi0wNC0yNVQxNTozMDowMFoECjIxMDAxMDAuOTkFCTMxNTAxNS4xNQ==

I got to know how to create the TLV and test it using TLV Utilities (emvlab.org).

Now, the question is, how to encode the previous TLV string into base64 programmatically in X++ to get the base64 string shown above??

I hope my question is clear and thank you in advance for your support.

Regards,

Ahmed


calling D365FO custom web service with REST API in the Logic app and specify call context (i.e. Multiple companies)

$
0
0

Hi All, 

I am trying to call Custom D365FO REST web service using client-id and ClientSecret in Logic App (i.e. HTTP Post). The web service executed the operation in the Default user context. I know that in the Soap version it is possible to switch the context/Company using      AX.CallContext callContext = new AX.CallContext() { Company = "XXXX" }. Which in turn generates 

<s:Header><h:CallContext xmlns:h="">schemas.microsoft.com/.../datacontracts" xmlns:i="">www.w3.org/.../h:Company><h:Language i:nil="true"/><h:MessageId i:nil="true"/><h:PartitionKey i:nil="true"/></h:CallContext></s:Header>

I would like to achieve the same in REST endpoint of this webservice. 

I tried the following: 

1. Added the call context in Body of the request 

   "CallContext": {
        "Company": "XXXX"
    },
2. Added CallContext in the header 
Nothing seems to work. Can someone advise how to switch the context?
Note: I don't want to add Company in data contract and then code does the company switching  

What is the following statement doing? We suspect it is killing the performance of the MRP run

$
0
0

We have captured stats for it, and there are 128 billion (!) logical reads generated by this statement (by far the most of any sql).
The 3 tables used all contain less than 1 million records.

SELECT T1.ITEMID,T1.COVINVENTDIMID,T1.REQDATE,T1.DIRECTION,T1.REFTYPE,T1.OPENSTATUS,T1.QTY,T1.COVQTY,T1.REFID,T1.KEEP,
T1.REQDATEDLVORIG,T1.FUTURESDAYS,T1.FUTURESMARKED,T1.OPRNUM,T1.ACTIONQTYADD,T1.ACTIONDAYS,T1.ACTIONMARKED,T1.ACTIONTYPE,
T1.PLANVERSION,T1.ORIGINALQUANTITY,T1.ISDERIVEDDIRECTLY,T1.PRIORITY,T1.ACTIONDATE,T1.FUTURESDATE,T1.INVENTTRANSORIGIN,
T1.BOMREFRECID,T1.MARKINGREFINVENTTRANSORIGIN,T1.LEVEL_,T1.BOMTYPE,T1.ITEMROUTEID,T1.ITEMBOMID,T1.ISFORECASTPURCH,
T1.LASTPLANRECID,T1.REQTIME,T1.FUTURESTIME,T1.SUPPLYDEMANDSUBCLASSIFICATION,T1.REQPROCESSID,T1.INTERCOMPANYPLANNEDORDER,
T1.PMFPLANGROUPPRIMARYISSUE,T1.CUSTACCOUNTID,T1.CUSTGROUPID,T1.ISDELAYED,T1.MCRPRICETIMEFENCE,T1.PDSEXPIRYDATE,T1.PDSSELLABLEDAYS,
T1.PMFACTIONQTYADD,T1.PMFCOBYREFRECID,T1.PMFPLANGROUPID,T1.PMFPLANGROUPPRIORITY,T1.PMFPLANNINGITEMID,T1.PMFPLANPRIORITYCURRENT,
T1.REQUISITIONLINE,T1.ISFORCEDITEMBOMID,T1.ISFORCEDITEMROUTEID,T1.FUTURESCALCULATED,T1.MZKWRAPPERID,T1.RECVERSION,T1.PARTITION,
T1.RECID,T2.RECEIPTRECID,T2.RECID,T3.ITEMID,T3.COVINVENTDIMID,T3.REQDATE,T3.DIRECTION,T3.REFTYPE,T3.OPENSTATUS,T3.QTY,
T3.COVQTY,T3.REFID,T3.KEEP,T3.REQDATEDLVORIG,T3.FUTURESDAYS,T3.FUTURESMARKED,T3.OPRNUM,T3.ACTIONQTYADD,T3.ACTIONDAYS,
T3.ACTIONMARKED,T3.ACTIONTYPE,T3.PLANVERSION,T3.ORIGINALQUANTITY,T3.ISDERIVEDDIRECTLY,T3.PRIORITY,T3.ACTIONDATE,T3.FUTURESDATE,
T3.INVENTTRANSORIGIN,T3.BOMREFRECID,T3.MARKINGREFINVENTTRANSORIGIN,T3.LEVEL_,T3.BOMTYPE,T3.ITEMROUTEID,T3.ITEMBOMID,
T3.ISFORECASTPURCH,T3.LASTPLANRECID,T3.REQTIME,T3.FUTURESTIME,T3.SUPPLYDEMANDSUBCLASSIFICATION,T3.REQPROCESSID,
T3.INTERCOMPANYPLANNEDORDER,T3.PMFPLANGROUPPRIMARYISSUE,T3.CUSTACCOUNTID,T3.CUSTGROUPID,T3.ISDELAYED,T3.MCRPRICETIMEFENCE,
T3.PDSEXPIRYDATE,T3.PDSSELLABLEDAYS,T3.PMFACTIONQTYADD,T3.PMFCOBYREFRECID,T3.PMFPLANGROUPID,T3.PMFPLANGROUPPRIORITY,
T3.PMFPLANNINGITEMID,T3.PMFPLANPRIORITYCURRENT,T3.REQUISITIONLINE,T3.ISFORCEDITEMBOMID,T3.ISFORCEDITEMROUTEID,T3.FUTURESCALCULATED,
T3.MZKWRAPPERID,T3.RECVERSION,T3.PARTITION,T3.RECID FROM REQTRANS T1 CROSS JOIN REQTRANSCOV T2 CROSS JOIN REQTRANS
T3 WHERE (((T1.PARTITION=@P1) AND (T1.DATAAREAID=@P2)) AND ((((((T1.DIRECTION=@P3) OR (T1.QTY<@P4)) OR (T1.COVQTY<@P5))
AND (T1.ISDERIVEDDIRECTLY=@P6)) AND ((T1.REFTYPE=@P7) OR (T1.REFTYPE=@P8))) AND (T1.PLANVERSION=@P9))) AND
(((T2.PARTITION=@P10) AND (T2.DATAAREAID=@P11)) AND (T2.ISSUERECID=T1.RECID)) AND (((T3.PARTITION=@P12) AND
(T3.DATAAREAID=@P13)) AND (((T3.RECID=T2.RECEIPTRECID) AND (T3.PLANVERSION=@P14)) AND (T3.ISDERIVEDDIRECTLY=@P15)))
AND EXISTS (SELECT 'x' FROM REQUNSCHEDULEDORDERS T4 WHERE (((T4.PARTITION=@P16) AND
(T4.DATAAREAID=@P17)) AND (((T4.PROCESSID=@P18) AND (T4.ENGINEBUNDLE=@P19)) AND (T4.REFID=T3.REFID))))

calling D365FO custom web service with REST API in the Logic app and specify call context (i.e. Multiple companies)

$
0
0

Hi All, 

I am trying to call Custom D365FO REST web service using client-id and ClientSecret in Logic App (i.e. HTTP Post). The web service executed the operation in the Default user context. I know that in the Soap version it is possible to switch the context/Company using      AX.CallContext callContext = new AX.CallContext() { Company = "XXXX" }. Which in turn generates 

<s:Header><h:CallContext xmlns:h="">schemas.microsoft.com/.../datacontracts" xmlns:i="">www.w3.org/.../h:Company><h:Language i:nil="true"/><h:MessageId i:nil="true"/><h:PartitionKey i:nil="true"/></h:CallContext></s:Header>

I would like to achieve the same in REST endpoint of this webservice. 

I tried the following: 

1. Added the call context in Body of the request 

   "CallContext": {
        "Company": "XXXX"
    },
2. Added CallContext in the header 
Nothing seems to work. Can someone advise how to switch the context?
Note: I don't want to add Company in data contract and then code does the company switching  

What is the following statement doing? We suspect it is killing the performance of the MRP run

$
0
0

We have captured stats for it, and there are 128 billion (!) logical reads generated by this statement (by far the most of any sql).
The 3 tables used all contain less than 1 million records.

SELECT T1.ITEMID,T1.COVINVENTDIMID,T1.REQDATE,T1.DIRECTION,T1.REFTYPE,T1.OPENSTATUS,T1.QTY,T1.COVQTY,T1.REFID,T1.KEEP,
T1.REQDATEDLVORIG,T1.FUTURESDAYS,T1.FUTURESMARKED,T1.OPRNUM,T1.ACTIONQTYADD,T1.ACTIONDAYS,T1.ACTIONMARKED,T1.ACTIONTYPE,
T1.PLANVERSION,T1.ORIGINALQUANTITY,T1.ISDERIVEDDIRECTLY,T1.PRIORITY,T1.ACTIONDATE,T1.FUTURESDATE,T1.INVENTTRANSORIGIN,
T1.BOMREFRECID,T1.MARKINGREFINVENTTRANSORIGIN,T1.LEVEL_,T1.BOMTYPE,T1.ITEMROUTEID,T1.ITEMBOMID,T1.ISFORECASTPURCH,
T1.LASTPLANRECID,T1.REQTIME,T1.FUTURESTIME,T1.SUPPLYDEMANDSUBCLASSIFICATION,T1.REQPROCESSID,T1.INTERCOMPANYPLANNEDORDER,
T1.PMFPLANGROUPPRIMARYISSUE,T1.CUSTACCOUNTID,T1.CUSTGROUPID,T1.ISDELAYED,T1.MCRPRICETIMEFENCE,T1.PDSEXPIRYDATE,T1.PDSSELLABLEDAYS,
T1.PMFACTIONQTYADD,T1.PMFCOBYREFRECID,T1.PMFPLANGROUPID,T1.PMFPLANGROUPPRIORITY,T1.PMFPLANNINGITEMID,T1.PMFPLANPRIORITYCURRENT,
T1.REQUISITIONLINE,T1.ISFORCEDITEMBOMID,T1.ISFORCEDITEMROUTEID,T1.FUTURESCALCULATED,T1.MZKWRAPPERID,T1.RECVERSION,T1.PARTITION,
T1.RECID,T2.RECEIPTRECID,T2.RECID,T3.ITEMID,T3.COVINVENTDIMID,T3.REQDATE,T3.DIRECTION,T3.REFTYPE,T3.OPENSTATUS,T3.QTY,
T3.COVQTY,T3.REFID,T3.KEEP,T3.REQDATEDLVORIG,T3.FUTURESDAYS,T3.FUTURESMARKED,T3.OPRNUM,T3.ACTIONQTYADD,T3.ACTIONDAYS,
T3.ACTIONMARKED,T3.ACTIONTYPE,T3.PLANVERSION,T3.ORIGINALQUANTITY,T3.ISDERIVEDDIRECTLY,T3.PRIORITY,T3.ACTIONDATE,T3.FUTURESDATE,
T3.INVENTTRANSORIGIN,T3.BOMREFRECID,T3.MARKINGREFINVENTTRANSORIGIN,T3.LEVEL_,T3.BOMTYPE,T3.ITEMROUTEID,T3.ITEMBOMID,
T3.ISFORECASTPURCH,T3.LASTPLANRECID,T3.REQTIME,T3.FUTURESTIME,T3.SUPPLYDEMANDSUBCLASSIFICATION,T3.REQPROCESSID,
T3.INTERCOMPANYPLANNEDORDER,T3.PMFPLANGROUPPRIMARYISSUE,T3.CUSTACCOUNTID,T3.CUSTGROUPID,T3.ISDELAYED,T3.MCRPRICETIMEFENCE,
T3.PDSEXPIRYDATE,T3.PDSSELLABLEDAYS,T3.PMFACTIONQTYADD,T3.PMFCOBYREFRECID,T3.PMFPLANGROUPID,T3.PMFPLANGROUPPRIORITY,
T3.PMFPLANNINGITEMID,T3.PMFPLANPRIORITYCURRENT,T3.REQUISITIONLINE,T3.ISFORCEDITEMBOMID,T3.ISFORCEDITEMROUTEID,T3.FUTURESCALCULATED,
T3.MZKWRAPPERID,T3.RECVERSION,T3.PARTITION,T3.RECID FROM REQTRANS T1 CROSS JOIN REQTRANSCOV T2 CROSS JOIN REQTRANS
T3 WHERE (((T1.PARTITION=@P1) AND (T1.DATAAREAID=@P2)) AND ((((((T1.DIRECTION=@P3) OR (T1.QTY<@P4)) OR (T1.COVQTY<@P5))
AND (T1.ISDERIVEDDIRECTLY=@P6)) AND ((T1.REFTYPE=@P7) OR (T1.REFTYPE=@P8))) AND (T1.PLANVERSION=@P9))) AND
(((T2.PARTITION=@P10) AND (T2.DATAAREAID=@P11)) AND (T2.ISSUERECID=T1.RECID)) AND (((T3.PARTITION=@P12) AND
(T3.DATAAREAID=@P13)) AND (((T3.RECID=T2.RECEIPTRECID) AND (T3.PLANVERSION=@P14)) AND (T3.ISDERIVEDDIRECTLY=@P15)))
AND EXISTS (SELECT 'x' FROM REQUNSCHEDULEDORDERS T4 WHERE (((T4.PARTITION=@P16) AND
(T4.DATAAREAID=@P17)) AND (((T4.PROCESSID=@P18) AND (T4.ENGINEBUNDLE=@P19)) AND (T4.REFID=T3.REFID))))

sum with group by clause

$
0
0

Hi all,

I stumbled upon a rather simple looking problem. i want the sum of multiple values from a table with group by, but i am not getting the value in the returning table buffer. below is my query and table data.

while select sum(RegAmount), sum(RegQuantity) ,sum(SalHours),sum(SalAmount),sum(OTHrs),sum(OTAmt),Dept,DeptName from mainTable
        group by mainTable.Dept
    {
        info(strFmt("%1,%2,%3",mainTable.Dept,mainTable.SalHours,mainTable.SalAmount));
    }

what is wrong with my query and how can i achieve this. Thank you

Customized fields add on batch job AX 20012 !

$
0
0

Hi Friends, I need to modify the batch job I.e., need to add 2 fields here as 'CustAccount and CustGroup', while I am trying to modify but can't worked. looks like as per standard functionality we can't be modified.

we have created the classed below,

while run the batch job, by-default showing like the below, here I need to add the required 'accountno and custgroup fields'

as per standard, we can't modify right.

can you please guide me if it's possible case, how can achieve ?

Regards,

Vinilkumar.

How to make grid text bold in ssrs report using visual studio expressions

$
0
0

Hi Experts,

I have a report and in the report there is a grid and in the grid i want to bold text using expressions only, all the texts no conditions simple bold text using visual studio expressions, please suggest.

Best Regards,

Shabir Ahmad


How to decrypt password? D365FO

$
0
0

I did the following:

1. created a container field  with EDT encryptionField called password in a table called Table1

2. edited the update and insert methods of the table

public void update()
{
Global::handleEncryptedTablePreUpdate(this);
super();
Global::handleEncryptedTablePostUpdate(this);
}

public void insert()
{
Global::handleEncryptedTablePreInsert(this);
super();
Global::handleEncryptedTablePostInsert(this);
}

3. Added this method to the table
public edit Password passwordEdit(boolean _set, Password value)
{
return Global::editEncryptedField(this, value, fieldNum(Table1,password), _set);
}

4. In the form, I made password style = yes

Now i want to decrypt this value by code and use it somewhere. In the sql dataBase the value of the field is Hexadecimal and when i write info(con2str(password)) i get alot of numbers.

How to decrypt the value?

Issue with JSON format

$
0
0

Dear all,

I have custom service which return list of data. But while its returning the data the list class also returning all parameter methods which is associated with service/List class. Please how can I fix this issue the list parameters that I don't required in json format. And I can't remove the parameter from class while its using for other service methods in same service class.

[DataContractAttribute]
class salesProj
{
   YearBase years;
   Name salesMan;
  ProjId projId;
  InvoiceDate invoiceDate;
  AmountMST invoiceAmountmst;

}

[ DataMemberAttribute('Year')]
public  YearBase parmInvoiceYear(YearBase _invoiceyear = years)

{

  years = _invoiceyear;

return years;

}

[ DataMemberAttribute('InvoiceAmount')]

public AmountMST parmInvoiceAmount(AmountMST _invoiceAmount = invoiceAmountmst)

{

 invoiceAmountmst = _invoiceAmount;

return  invoiceAmountmst;

}

[ DataMemberAttribute('ProjId')]
public ProjId parmProjId(ProjId _projectId = projId)
{

  projId = _projectId;

return   projId;

}

[ DataMemberAttribute('Salesman')]
public Name parmSalesman(Name _salesMan =  salesMan)

{

  salesMan = _salesMan;

return  salesMan;

}

[SysEntryPointAttribute(true),AifCollectionTypeAttribute("return" , Types::Class, classStr(salesProj))]
public List getprojTotalCurrentYearAmount()
{
  salesProj salesClassObj;

  List saleslist = new List(Types::Class);

   salesClassObj = new salesProj();


   salesClassObj.parmInvoiceYear(2021);
   salesClassObj.parmInvoiceAmount(this.currentYearProjSales());

   saleslist.addEnd(salesClassObj);

     return saleslist;

}


C# Web api

 [HttpGet]
        [Route("api/getProjSales")]
        public HttpResponseMessage GetProjSales()
        {

            CallContext callContext = new CallContext();
            callContext.Company = "ENPR";
            callContext.Language = "en-us";

            testcustomerClient client = new testcustomerClient();
            custClass[] salesProj = client.getProjSales(callContext);
            List<custClass> saleslist = new List<custClass>();
            foreach (var item in salesProj)
            {
                saleslist.Add(item);
            }

            return Request.CreateResponse(HttpStatusCode.OK, saleslist);

        }
        
        //Json formart
        
        [{"InvoiceAmount":25072.43,"InvoiceDate":"1900-01-01T12:00:00","ProjId":"","Salesman":"","Year":2021}]
        How can I remove "InvoiceDate":"1900-01-01T12:00:00","ProjId":"","Salesman":"", above format while list class from AX its returning all parameters.

How to make a relation between view and table in form

$
0
0

here custtable is table and apnttaxregistrationview is a view, how to give relation between these two ?

thanks in advance.

How to use in view while loop

$
0
0

Hi all,

I have an one display method and now that method i need to move as computed column.

Below code: -

       WorkflowWorkItemTable workitem;
        str users;

        while select UserId from workitem
        where workitem.RefRecId == this.RecId
        && workitem.RefTableId == this.TableId&& workitem.Status == WorkflowWorkItemStatus::Pending
        {
            users += HcmWorker::find(HcmWorker::userId2Worker(workitem.UserId)).name() + ",";
        }
        return users;
 

Same code i want to select in computed column don't know how to do  : -   ","  this kinda please give me example for that.

Thanks 

Access the D365 F&O entities using the .net core client

$
0
0

I am creating a ASP.net core Web API and want to access the D365 F&O entities along with its data within the API.

Could you please help by providing some samples or pointers to achieve it?
What is the easiest way to achieve it? Is there any alternatives?

Unable to start AOS service AX2009

$
0
0

Hi, 

Our Client has the AX2009, the AOS Service is stopped and when I try to start it I receive the error bellow in event viewer  : 

and when I try to open the AX SERVER CONFIG I receive this error : 

this is the event viewer message :

any help would be appreciated.

Best Regards

Unable to apply Medius package

$
0
0

Hi All,

We are trying to apply Medius package (ISV) in UAT environment, getting the below error:

Is there any impact on existing models if we say "Confirm" in that step, or do we need to take any actions from which we can apply the Medius package without any impact on existing models.

Please advise us.

Regards,

Akbar


Where to check "The server has encountered error"

$
0
0

Hi all,

Need your professional advice, when we encounter such error, where to check what happened ?

It's an Dynamics 365 F&O, I'm now in version 10.0.24.

This is from my test VM, have tried to restart VM but the problem still persist. When checking inside the VM, I've checked the IIS and Dynamics 365 service also running. 

I believe there is no code error, since when Build and Synchronize in my own VM, it was fine. This error happened after it is deployed to the test VM.

Thanks,

How to run electronic report from menu item

$
0
0

Hello,

we have created a Electronic report.

How is it possible to link it to menu item, so that we can place it on the form?

Are there any standard features that I can have a look to?

Is there any way to use (find All References) option via x++ code

$
0
0

HI All,

I have a requirement where I need to know how many objects in AOT uses my class or form dynamically.

I know there is an option of Find All references via which it is possible. But I want to do the same via code.

Can it be done? 

Please suggest me if at all there is any possibility.

Thanks in advance!!

InventDimID gets replaced in SalesLine

$
0
0
Hi all,


I am trying to create a salesLine using following piece of code.

    SalesLine	salesLine;
	InventDim	inventDim;
	InventTable	inventTable;
	
	salesLine.clear();
	inventDim = null;
	salesLine.initValue();

	salesLine.SalesId = salesTable.SalesId;
	salesLine.initFromSalesTable(salesTable);

	salesLine.ItemId = '123';	
	
	inventTable = InventTable::find(salesLine.ItemId);
	salesLine.initFromInventTable(inventTable);
    
    inventDim.selectForUpdate(true);
    inventDim.InventLocationId  = "Value"; 
    inventDim.InventSiteId      ="Value";
    inventDim.inventBatchId="Value";
	
	salesLine.InventDimId = InventDim::findOrCreate(inventDim).InventDimId;

	salesLine.SalesQty =  1;

	salesLine.SalesPrice = 3200.00;
	
	salesLine.LineAmount = salesLine.calcLineAmount();
	
	salesLine.createLine(true,true,false,true);


But the problem I am facing is that InventDimID in SalesLine gets replaced after "creatLine". InventDimID "before creatLine" is the one that has InventBatchID, but InventDimID "after createLine" is the one that does not have InventBatchID.

How can I prevent this from happening ? I want the inventDimID that has InventBatchID value.

Insert into database if text field holds data starting with (Product Type*)

$
0
0

Form Text Field: 

Want to allow user just to insert data that start with "PRODUCT TYPE" 

and further they can add as below

Product Type

Product Type-1

Product Type-91

Product Type-33

Product Type-BAX

Product Type-UAT

Viewing all 17532 articles
Browse latest View live


Latest Images