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

Copy uploaded files

$
0
0

Hi,

does anybody has experience with copy of uploaded files? Or is there an example in D365?

I want to upload a file, do something with the file and copy it to a new file...

Thank's in advance


Can I apply exists join to only one of the join hierarchy in a select statement?

$
0
0

Sorry if this question has no sense or if the question is badly written.. but I'm really curious. 

See code below:

select field1 from table1
    join field2 from table2
         where table1.field == table2.field
    join field3 from table3
         where table1.field == table3.field
    exists join table4
         where table3.field == table4.field

I'm curious about if I can only apply the exists join to table3 and not affect the entire select statement? is that possible? 

Reading input files from an FTP server

$
0
0

We have a third party who sends data input files (csv) to an FTP server. I want to connect to the FTP server, read the data from the files, and import to the appropriate tables in D365 FO. The hurdle I'm not sure how to clear is connecting to the FTP server and reading the data in the files. Is anyone aware of how I could do this?

Customer Aging Report - adding a field from custTrans

$
0
0

My goal is to add the value of the method CustTrans.custPaymManAmountMST in the report. 

Here is the method:

static server AmountMST openAmountMST(CustAccount _custAccount, CurrencyCode _currencyCode = '*')
{
    CustTrans           custTrans;
    CustPaymManTrans    custPaymManTrans;
    ;
    select sum(AmountMST) from custTrans
        where custTrans.AccountNum      ==   _custAccount   &&
              custTrans.CurrencyCode    like _currencyCode
        exists join custPaymManTrans
            where   custPaymManTrans.RefRecId == custTrans.RecId;

    return  -custTrans.AmountMST;
}

Upon populating the temp table custAgingReportTmp, I noticed that there's an AccountNum field. So there's no problem of just joining the table CustTrans to the statement.

insert_recordset custAgingReportTmp
           (fields here)
                select
                    (fields here)
                from tmpAccountSum
                    join SortOrder
                        from custVendTransAging
                            where tmpAccountSum.AccountNum == custVendTransAging.AccountNum
                                join AmountMST
                                    from custTrans
                                        where tmpAccountSum.AccountNum == custTrans.AccountNum

I added the custTrans and I successfully displayed it in the report. However, the AmountMST I need to get, should check if it exists in this table another table (as seen on the custPaymManAmountMST method) which is:

exists join custPaymManTrans where custPaymManTrans.RefRecId == custTrans.RecId;

but when I add this exists join syntax above, I get 0 returns

Is there anyway I can apply the exists join to that I can get the correct AmountMST? or my approach is incorrect?

Protocol and attributes used by Dynamics 365 Finance & Operations to connect Azure AD

$
0
0

One of our client has existing Azure AD subscribed with Office 365 account while another tenant is created with different domain when they subscribed Dynamics 365 Finance & Operations. Now we are trying to develop a customized application agent that will authenticate their Office 365 users to Azure AD.

I need to understand protocol and attributes used by Dynamics 365. Please help.

Add image on form extension

$
0
0

Hi,

i want to add an image on form extension but I don't know how to do it...

I create an FormImageControl (AutoDeclaration = YES) with an Datasource (no standard table) and DataSourceMethode.

I have to initialize the following:

ImageList AnyImageList= new ImageList(); //must be place on form extension class?

FormImageControl.ImageList(AnyImageList); //must be place on form extension class?

public display ImageRes displayMethode()  //must be placed at DataSource?

{

return AnyImageList.Image(#Image);

So can anybody help me to create this logic at the right place because I don't know a way to initialize the DataSource in form extension class and call the display methode.

Thank's in advance...

Calling D365 master data Odata feed from Excel VBA through code

$
0
0

Hi Experts,

I an AX developer. So, ignorant about VBA scripting .

I am working on a development item where I have to write code in VBA in EXCEL VBE to call d365 Odata Feed. The purpose is to show the master data(eg.. currency codes) in an excel cell. I have tried the below links, but, couldn't get much info and they were throwing errors.

https://blogs.msdn.microsoft.com/marcelolr/2010/02/16/consuming-odata-with-office-vba-part-i/

I have changed this statement from 

Set objDocument = ODataReadUrl("ogdi.cloudapp.net/.../ConusPerDiemRates2009")

to this

Set objDocument = ODataReadUrl("https://ircdev3-813e6544f9c534cefddevaos.cloudax.dynamics.com/data/").

When I run it, it is throwing me the errors.

And goes to ODataReadUrl statement in debugging mode.

I changed the code a bit, but, it is more or less the same. Here is the code.

'Option Explicit

' References that need to be added:
' Microsoft XML, v6.0
' Microsoft Scripting Runtime

Const ODataErrorFirst As Long = 100
Const ODataCannotReadUrlError As Long = ODataErrorFirst + 1
Const ODataParseError As Long = ODataErrorFirst + 2

' Given a URL, reads an OData feed or entry into an XML document.
Function ODataReadUrl(ByVal strUrl As String) As MSXML2.DOMDocument60
Dim objXmlHttp As MSXML2.XMLHTTP60
Dim objResult As MSXML2.DOMDocument60
Dim strText As String

' Make a request for the URL.
Set objXmlHttp = New MSXML2.XMLHTTP60
objXmlHttp.Open "GET", strUrl, False
objXmlHttp.setRequestHeader "Authorization", "Basic " + Base64Encode("VermaMC@xxxx.com" + ":" + "password")
objXmlHttp.send

If objXmlHttp.Status <> 200 Then
Err.Raise ODataCannotReadUrlError, "ODataReadUrl", "Unable to get '" & strUrl & "' - status code: " & objXmlHttp.Status
End If

' Get the result as text.
strText = objXmlHttp.responseText
Set objXmlHttp = Nothing

' Create a document from the text.
Set objResult = New MSXML2.DOMDocument60
objResult.LoadXML strText
If objResult.parseError.ErrorCode <> 0 Then
Err.Raise ODataParseError, "ODataReadUrl", "Unable to load '" & strUrl & "' - " & objResult.parseError.reason
End If

Set ODataReadUrl = objResult
End Function

Public Sub Sample1()
Dim objDocument As MSXML2.DOMDocument60
Set objDocument = ODataReadUrl("xxxxxxx8666844f9c534cefddevaos.cloudax.dynamics.com/.../VendorsV2")
ActiveDocument.Content.Font.Name = "Vendors"
ActiveDocument.Content.Font.Size = 9
ActiveDocument.Content.Text = objDocument.XML
End Sub

Please guide me.

Regards,

Chiranjeevi M.

How to read excel row object and store in the container or other format?

$
0
0

I know how to read cell value eg. sheet.cells().item(3,2).value()

but, how can I get row and store in container?

eg. container con;

str value;

con = sheet.row(3);

value = conpeek(con, 2);


Package movement to production environments

$
0
0

I am facing a issue when applying a package from a sandbox environment to a production environment. I get the error below.

"The selected package is incompatible with the environment.
The environment 'kel' is of Platform version: Update 20 - 7.0.5030.35333, Application version: 8.1 - 8.1.136.24. The package and its solution is: (1) KELLIVE (Platform version: Update 20 - 7.0.5030.35333, Application version: Unknown - Unknown): error message: The package is not compatible with app8.1+ environment.; solution: Please ensure that the package is built for a app8.1+ environment."
The deployment package was created from a Dev environment that is on the same Application Version and Platform as Production environment. What could I be missing here?

Increasing of item cost at PO without posting in accounting

$
0
0

Dear community,

my customer wants to calculate a particular percentage of cost for particular items and whenever the items get purchased, the stock value should increase (e.g. 3 % for transportation costs).

I know that there's a possibility in standard to connect e.g. transport invoices to items afterwards, but doing this for every purchase order line would mean a lot of manual work for the users which they want to avoid.

I first tried to use charges (setup debit item, credit any account) which actually works (increases the item cost in inventory) but I don't want the calculated cost to get posted on my trade good P&L account as in fact no vendor invoices exactly this calculated amount.

So actually I'm searching for a solution to get costs on my inventory value of the item at the time of the purchase order receipt and invoice but not as a profit and loss in my accounting. The "real" profit and loss for e.g. for transportation cost will get posted with the invoice of the carrier anyway. If I have to post it nevertheless, I could use the same account (or two new accounts) for debit and credit in accounting, this wouldn't be a problem, but when I tried to set this up in charges, I didn't get the cost on the item value anymore, just on the accounts (debit P&L, credit P&L).

Does anybody have experience with this topic or probably just a very good idea?

Solutions and suggestions are greatly appreciated.

Kind regards,

Katy

How to make selected proj id as sender object to another forms init method.

$
0
0

In all projects form we have a checkmark column adjacent to proj id column.

Pls let me know how can i make selected proj as sender object to another forms init method.

List Custom Objects within D365FO

$
0
0

I have been tasked with coming up with a way to report on all custom objects (tables, menu items, data entities, service operations, classes, roles, duties, privileges) within a D365FO environment. I thought I had a viable solution with the following:

1) Since Microsoft is sealing all base models, we can determine that all customizations must occur within a model within the ISV layer or above (layer 8 or above), so step 1 is generating this list of models.

//Limit modules to those with Layer >= 8 (ISV Layer)
var modules = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetInstalledModuleInfo();

2) Take this list of models, and get all objects within these models

Microsoft.Dynamics.AX.Metadata.Storage.MetadataProviderFactory metadataProviderFactory = new Microsoft.Dynamics.AX.Metadata.Storage.MetadataProviderFactory();
var environment = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();
str packageDir = environment.get_Aos().get_PackageDirectory();
Microsoft.Dynamics.AX.Metadata.Storage.DiskProvider.DiskProviderConfiguration diskProviderConfiguration = new Microsoft.Dynamics.AX.Metadata.Storage.DiskProvider.DiskProviderConfiguration();
diskProviderConfiguration.AddMetadataPath(packageDir);
Microsoft.Dynamics.AX.Metadata.Providers.IMetadataProvider provider = metadataProviderFactory.CreateDiskProvider(diskProviderConfiguration);
//This is just classes, there are other objects under the provider including tables, menu items, data entities, service opertations, etc
var customClasses = provider.Classes.ListObjectsWithModificationInfo("ModuleName");

The above method works great for customizations made in the environment itself but the ListObjectsWithModificationInfo call will return a blank list if ran against a module from an ISV/3rd party (or any code) that was deployed via deployable package.

Is there any way using the above method to get this information, or can anyone think of another way to get this information?

registerOverrideMethod not working, trying to make custom lookup for a dialog field

$
0
0

Hello i m new to ax and i cant figure this problem out.
I'm trying to make custom lookup for a dialog field.

Object dialog()
{
FormStringControl control;
;
dialog = super();


rateTypeSelect = dialog.addField(extendedTypeStr(RPayRateCode));
control = rateTypeSelect.control();
control.registerOverrideMethod(methodStr(FormStringControl,lookup), methodStr(RpayRateImport_bit,rPayRateCodeLookup), this);

return dialog;
}

private void rPayRateCodeLookup(FormStringControl _control)

{

SysTableLookup sysTableLookup;

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange querybuildrange;

Query query = new Query();

queryBuildDataSource = query.addDataSource(tablenum(RPayRateTrans));

querybuildrange = queryBuildDataSource.addRange(fieldNum(RPayRateTrans,LineType));

querybuildrange.value(enum2str(RPayRateType::Employee));

sysTableLookup = SysTableLookup::newParameters(tablenum(RPayRateTrans), _control);

sysTableLookup.addLookupfield(fieldnum(RPayRateTrans, PayRate), true);

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}

however debuger does not stop in rPayRateCodeLookup method.

Additional info:

rateTypeSelect - DialogField  declared in classDeclaration.

class- RpayRateImport_bit

Lookup works but it returns same values if i comment out /* control.registerOverrideMethod(methodStr(FormStringControl,lookup), methodStr(RpayRateImport_bit,rPayRateCodeLookup), this); */

Please help what i m missing?

Getting error while consuming AX custom service from console application

$
0
0

I have created a custom service in D365 for creation of Customer,creation of Sales order  which has a parameter of "XXXX" class.In my parameter(Contract) class I have a ParmMethod of type  IEnumerable , form which I can get the set of instances of SalesLine creation Paramter(Contract) class from Console Application.

1.C# code for consuming service.

using (OperationContextScope dimServiceOperContext = new OperationContextScope(dimServiceChannel))
{
HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
requestMessage.Headers[OAuthHeader] = oAuthHeader;
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;

CallContext callContext = new CallContext { Company = "PTCL" };
DateTime transDate = new DateTime(2018, 12, 22);

LTMagentoParameters contract = new LTMagentoParameters(); 
contract.qty = 1;
contract.accountNumber = "C-002122";
contract.address = "#17,Al Jabeel,Abudabi";
contract.companyId = "PTCL";
contract.currency = "AED";
contract.firstName = "Mujahid";
contract.lastName = "Test";
contract.custName = "Shravan Test";
contract.PhoneNum = "9700111935";
contract.email = "Shaan123@gmail.com";
contract.salution = "Salution";
contract.guestFlag = NoYes.No;
contract.salesId = "MagentoSO-002";
contract.paymentStatus = NoYes.No;
contract.sameDayDelivery = NoYes.Yes;
contract.voucher = "MagentoVCH002";
contract.methodOfPayment = "CSH";
contract.sameDayDeliveryAmt = 10;
contract.lineNum = 1;

LTMagentoSaleslineCreation salesLine= new LTMagentoSaleslineCreation();

LTMagentoSaleslineCreation salesLine1 = new LTMagentoSaleslineCreation();
List<LTMagentoSaleslineCreation> salesLineList = new List<LTMagentoSaleslineCreation>();
//first salesline
salesLine.itemId = "6771330";
salesLine.price = 10;
salesLine.unit = "SLV";
salesLine.discountPercent = 5;
salesLine.salesId = "MSO-0003";
salesLine.qty = 1;
salesLineList.Add(salesLine);

//second
salesLine1.itemId = "12269344";
salesLine1.price = 10;
salesLine1.unit = "Tube";
salesLine1.discountPercent = 5;
salesLine1.salesId = "MSO-0003";
salesLine1.qty = 10;

salesLineList.Add(salesLine1);

LTMagentoSaleslineCreation[] arr = new LTMagentoSaleslineCreation[salesLineList.Count];

for (int i = 0; i < salesLineList.Count; i++)
{
LTMagentoSaleslineCreation obj = new LTMagentoSaleslineCreation();
obj = salesLineList[i];
arr[i] = obj;
}
contract.list = arr; 
string s = ((MagentoIntegrationService)dimServiceChannel).createSalesOrder(new createSalesOrder(callContext, contract)).result;

// Call getDimensionAll method of dimension service
/*
IList<LTMagentoParameters> dimensionContracts = ((MagentoIntegrationService)dimServiceChannel).createSalesOrder(new createSalesOrder(callContext, contract)).result;
foreach (LTTAIntegrationContract dimensionContract in dimensionContracts)
{
Console.WriteLine(string.Format("Dimension: {0}", dimensionContract.parmEmployeeId()));

}
*/
}

2."XXXX Paramter class Parm method which is accepting IEnumerable."

System.Collections.IEnumerable list;

[DataMemberAttribute('Sales order line creation')]
public System.Collections.IEnumerable parmSOLinesList(System.Collections.IEnumerable _list = list)
{
list = _list;
return list;
}

3.Iam getting below error after passing value for above "IEnumerable" Parameter.

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org:_parameter. The InnerException message was 'Error in line 1 position 1896. Element 'schemas.microsoft.com/.../Arrays:anyType' contains data from a type that maps to the name 'schemas.datacontract.org/.../Dynamics.AX.Application:LTMagentoSaleslineCreation'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver if you are using DataContractSerializer or add the type corresponding to 'LTMagentoSaleslineCreation' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to the serializer.'.  Please see InnerException for more details."}

operand types are not compatible with the operator

$
0
0

Hi everyone,

I occasionaly create job that's why i'm not familiar with this type of error, could you please help me ?

public static void LAF_Update_Sales_Orders(Args _args)
{


SalesTable           SalesTable;
int CPT;

ttsBegin ;

while select forUpdate SalesTable where
                        SalesTable.SettleVoucher == "Open transactions"
                        && SalesTable.Salesstatus == "Open Order"


{
    SalesTable.SettleVoucher = None
    CPT = CPT+1;
}

ttsCommit ;

    info(strfmt("fin du script LAF_Update_Sales_Orders '%1'", CPT));

}



Thanks !


OData sample console project and Build Odata connection in visual studio

$
0
0

Hi All,

I am new in AX 7 Odata. And I have build a dataEntity follow https://ax.help.dynamics.com/en/wiki/building-and-consuming-data-entities/

My questions is how to build the Odata connection in C# and call the method like create, update, read...

My testing environment AX7 VM, so it's url is https://usnconeboxax1aos.cloud.onebox.dynamics.com

Can anyone provide the sample code/procedure? Many thanks!!

Further question:

In AX7 VM version, I tried my email account binding with the AX7 Admin user but not worked. Did anyone know how to enter the credential when add the Odata reference service? Thank you!

Is there any job running which i can find list of events in entire AOT.

$
0
0

Is there any job or any other way to use to find list of events in entire AOT.

Issue with date Formats in Query Where clause

$
0
0

Hi experts,I am facing a problem in x++ select statement with date in where clause. Issue is that the date coming from form control is in format 1/8/2019 (dd/mm/yyyy),but for query to return data i want date in this format 01\08\2019 dd\mm\yyyy).

Query screen shot is attached for reference.I also used BackOrderDate.dateValue() but it only changes month and day sequence.

Anyone please guide help me how to fix it in x++.

Product xxxx is on hold in Sales Order

$
0
0

Hi,

I would like to know why i create the sales order with item and save it. It shows an error "Product "xxxx" is on hold". Where can i set this product to disable on-hold. I try it to see in inventory management seems nothing there. Do you have any idea?

Thank you for your reply.

How to move values between multiple elements.

$
0
0

There are 3 forms

Form 1 ProjProjectlistpage 

Form2   Myform2

Form3   Myform3

Using args i was able to populate the selected proj id in form1 within form2 

How do i populate the same proj id within form 3 .

Say for example selected proj id is proj101 in form 1 

 I get the related data of proj101 in form 2 as i can populate proj101 via args .

Challenge now is how do i keep holding the value of this proj101 and get its related data in form 3.

Please note that data source of form2 & form 3  is same  temp table by design which cant be changed.

Also is there any blog referring which i can learn about how to pass values between different elements

Viewing all 17532 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>