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

insert data in to inheritance table gives error

$
0
0

Hi 

I am facing error inserting data in a table of retail _RetailPeriodicDiscount in dynamics AX 2012 R3 by x++ code table has inherited property how can i insert data in inherited table my code is below

and my Facing the following error.

Database insert operation is not allowed on an abstract table.

static void CreateDiscountScheem_3(Args _args)
{
RetailPeriodicDiscount _RetailPeriodicDiscount;
NumberSeqFormHandler numberSeqOfferId;
LedgerDimensionDefaultAccountController discountDimAccController;
///----- Field-------
RetailOfferIdEx3 OfferId;
Name DiscountScheemName;
//RetailDisabledEnabled ScheeemStatus;
int ScheeemStatus;

CurrencyCode Currency;
RetailDiscountConcurrency _ConcurrencyMode;
Status _ActiveInActive;
RetailDiscountPercentValue _DiscountPercentValue;
ValidFromDate _ValidFrom;
ValidToDate _ValidTo;
RefRecId _PriceDiscGroup;
RetailMemo _Description;
RetailDiscountOfferTypeBase _PeriodicDiscountType;

NumberSeq num;
str test;
//////////////////////////
ScheeemStatus=1;
_DiscountPercentValue=20;

// NumberSeq NumberSeq;
ttsBegin;
num = NumberSeq::newGetNum(RetailParameters::numRefOfferId());
test=num.num();
_RetailPeriodicDiscount.OfferId =test;
_RetailPeriodicDiscount.Name=DiscountScheemName;
_RetailPeriodicDiscount.Status=1;//ScheeemStatus;
_RetailPeriodicDiscount.CurrencyCode='PKR';
_RetailPeriodicDiscount.ConcurrencyMode= (RetailDiscountConcurrency::Exclusive);
_RetailPeriodicDiscount.DiscountPercentValue=_DiscountPercentValue;
_RetailPeriodicDiscount.DiscountLedgerDimension=5637144584;
_RetailPeriodicDiscount.ValidFrom =23\07\2019;
_RetailPeriodicDiscount.ValidTo=31\07\2019;
_RetailPeriodicDiscount.DateValidationType =RetailDateValidationTypeBase::Standard;
_RetailPeriodicDiscount.PeriodicDiscountType=RetailDiscountOfferTypeBase::DiscountOffer;
_RetailPeriodicDiscount.insert();

// info(test);
// num = NumberSeq::newGetNumFromCode(numberSequenceTable::findByNaturalKey('Reta_16').NumberSequence);
// NumberSeq =NumberSeq::newGetNumFromCode(NumberSequenceTable::findByNaturalKey('Reta_16').NumberSequence);
//NumberSeq::newGetNum(RetailParameters::numRefOfferId());

//Info(NumberSeq::newGetNum(FCMParameters::numRefWorkOrderNum()).num());
// _RetailPeriodicDiscount.
ttsCommit;

}


Bringing financial dimension in ssrs report dialog?

$
0
0

Bringing financial dimension in rdp contract class in D365 finance and operation 

XppCompiler and runbuf in AX7

$
0
0

We need to generate source code and run it but we can't do it in AX7. the idea is to implement  dependent rules  and formulas,  the user parametrize this,

for example we would like to generate if (part1 operator part2) then part3 else part 4 , part1, part2, part3 and part4 are dynamic based on formula test, or any complex treatements.

This was done in Ax 2012 with runbuf and xppcompiler, actually we can't use them. why ans is there any other alternate option rather than runAs

relationships between the two tables

$
0
0

Goodmorning everyone
For internal company needs, I have to develop an application that will read the data directly in the AX database.
I have to make a select between these two tables
PURCHLINE and KIL_METALATTRIBUTES.


If I go to see the relationships between the two:
PURCHLINE.recid == KIL_METALATTRIBUTES.ReferenceRecid
and
PURCHLINE.TableId == KIL_METALATTRIBUTES.ReferenceTableid
The problem is that the PURCHLINE.TableId column does not exist.


Without it I can't find a unique result. Do you have any idea how to help me?

How to apply filter on grid

$
0
0

Hello, 

How to achieve , if I want my Grid on the list page to be filtered by default. For example only active employees should show by default when I login. 

Access to D365FO tables via PowerApps/CDS

$
0
0

Hi all, I'm attempting to use PowerApps to pull data from D365FO to CDS for PowerBI and PowerQuery purposes. 

What I have found within PowerApps is that I am restricted to mapping standard D365FO entities to custom entities in PowerApps. This is all well and good, except that I'm really interested in accessing data stored on tables (e.g. the Posted Tax inquiry in the Tax module) which to my knowledge is not available on standard entities (would welcome being wrong about this fact). I'm aware I can use O-Data connections for a direct link between PowerQuery and D365FO, but this is again restricted to standard entities.

Outside of development to create custom entities, is there any way that I can push data which to my knowledge is only stored onto tables into solutions like PowerQuery and PowerBI via PowerApps or otherwise?

Many thanks in advance,

Toby

Internal error on writing to CSV file

$
0
0

Hello All,

Can anyone help me on this ?   Thank you :)

Recordinsertlist with inmemory table ax 2012

$
0
0

Hi,

Can we use recordinsertlist with Inmemory table.

Thanks in advance.


How to call the current record in the method from the event handler method of data source which is static method.

$
0
0

Hello all,

I want to call the current record in the method from the event handler method of data source which is static method.

The code written is this:

class HRMApplicationEventHandler
{
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    [FormDataSourceEventHandler(formDataSourceStr(HRMApplication, HcmApplicant), FormDataSourceEventType::ValidatedWrite)]
    public static void HcmApplicant_OnValidatedWrite(FormDataSource sender, FormDataSourceEventArgs e)
    {
        HRMApplicationEventHandler hrmApplicationEventHandler = new HRMApplicationEventHandler();
        HRMApplication hrmApplication = sender.cursor();
        //FormDataSource hrmApplicationds = sender.formRun().dataSource(formDataSourceStr(HRMApplication, HcmApplicant));
        hrmApplicationEventHandler.personNameDob();
        hrmApplicationEventHandler.personNamePassportNum();
        hrmApplicationEventHandler.dobPassportNum();
    }
    public void personNameDob()
    {
        FirstName                             firstName;
        MiddleName                            middleName;
        LastName                              lastName;
        BirthDate                             birthDate;
        DirPersonName                         dirPersonName;
        DirPerson                             dirPerson;
        HcmPersonPrivateDetails               personPrivateDetails;
        HcmPersonRecId                        personRecId;
        select firstonly dirPersonName
            where dirPersonName.FirstName == firstName
            && dirPersonName.MiddleName == middleName
            && dirpersonName.LastName == lastName
            join personPrivateDetails
            where personPrivateDetails.BirthDate == birthDate
            && personPrivateDetails.Person == dirPersonName.Person;
        if(dirPersonName.RecId)
        {
            warning("It appears that the details of this record match with an existing employee record (insert employee # and employee name). Please proceed accordingly.");
        }
    }
}

I want to call the current record in the method personNameDob() from the event handler method HcmApplicant_OnValidatedWrite(FormDataSource sender, FormDataSourceEventArgs e) which is static method.

Thank You 

Siddhant

Restrict development for legal entity

$
0
0

Hi Experts,

In our D365 enviroment , we have 4 legal entities.
We have some development related to sales order - made some field mandatory while creating SO, like this we have some more developments.

Now when we move code from dev Box to UAT, development is reflecting to all legal entities as its standatard behaviour.

Our requirement is to show some developments to just single legal entity instead of all.
What is the best practice to achieve the same.

Thank you

Sona Jee

unable to consume d365 webservice via php

$
0
0

Hi, 

I am trying to call methods through a wsdl URL (domain.sandbox.ax.dynamics.com/.../somename via PHP Soap Client. 

I am able to get the list of Functions (Methods), but when I call the methods no matter if I add parameters or not I always get a Forbidden error.

The response string I get:

a:ForbiddenForbidden608System.ComponentModel.Win32ExceptionThere is insufficient account information to log you on. 

Can anyone help me on this?

The following number of exchange rates were imported: 0

$
0
0

Hello,

We can't import currency exchange rates central bank of Europe in UAT. we get the following warning. We copy/past the link XML in the browser i can see all currency exchange

We can import them in DEV environment that have the same setup.

Index -field used to join tables

$
0
0

Hi,

Is it required to add the field used in joining tables as part of index.

select * from TableA

  join * from TableB

   where TableA.field1 == TableB.field2

         && TableA.field3 == 20;

Should I add field1 as part of index of TableA?

Thanks in advance.

How to Pass values

$
0
0

Hi guys 

The Screenshot have been attached , when I type "6" in the ' item number box' it will show as "600" in the 'percent num box'.

Form -Sales Table

And my code is 

[FormControlEventHandler(formControlStr(SalesTable, ItemNumber), FormControlEventType::Modified)]
public static void ItemNumber_OnModified(FormControl sender, FormControlEventArgs e)

{

FormRun formRun = sender.formRun() as FormRun;
FormDataSource SalesTable_ds = FormRun.dataSource();


SalesTable salestable              = SalesTable_ds.cursor();
MCRSalesStatsCustTable        mcrsalesstatscusttable;


if(SalesTable.SalesId =="000783")
{
SalesTable.PercentNum = SalesTable.NumberItem*100;
info(strFmt("%1",SalesTable.PercentNum));
}

}

My requirement is , I should get that value "600" in the copy Number box(Screenshot attached down)

Form -MCRSales Stats cust table 

relation - MCRSalesStatscusttable.CustAccount == CustTable.AccountNum;

 above code is working fine for the first screenshot ,please help me to solve this requirement.

Sending data from third party to import into D365FO.

$
0
0

I am developing an application for D365FO and have a requirement from client so he can send data to D365FO to integrate with my application.

Our client will set up the unique field to track which data has been added to D365FO database and will send collection of data every a couple of hours.

So I am thinking the data entities  so our client can send the data through rest api. 

1. My questions is since we don't go through data import/eport module the data won't go through the staging table how can I validate those data to make sure all required fields are filled?

2. Is there any limitation of size of data our client can send through data entity. 

3. Is there any way to limit our client to send data every 5 minutes instead of every seconds?

4. Is there any better approach to do this?


join using QueryBuilder

$
0
0

 i am trying to create join query but unfortunate i am doing something wrong.plese help me with below this.
public static void main(Args _args)
{

Query query = new Query();
QueryRun queryrun;
QueryBuildDataSource qbds,qbds1,qbdsDimensionAttributeValueSet,qbdsDimensionAttributeValueSetItem,qbdsDimensionAttributeValue,qbdsDimensionAttribute;
QueryBuildRange qbr;
ITLRESPrincipalDisbursementSchedule ITLRESPrincipalDisbursementSchedule;

DimensionAttributeValueSet DimensionAttributeValueSet;
DimensionAttributeValueSetItem DimensionAttributeValueSetItem;
DimensionAttributeValue DimensionAttributeValue;
DimensionAttribute DimensionAttribute;


// qbds1 = query.addDataSource(tableNum(ITLRESPrincipalDisbursementSchedule));

qbds1 = query.addDataSource(tableNum(ITLRESPrincipalDisbursementSchedule), "ITLRESPrincipalDisbursementSchedule");


qbdsDimensionAttributeValueSet.joinMode(JoinMode::InnerJoin);
qbdsDimensionAttributeValueSet.relations(false);

qbdsDimensionAttributeValueSet = qbds1.addDataSource(tableNum(ITLRESPrincipalDisbursementSchedule),"ITLRESPrincipalDisbursementSchedule");
qbdsDimensionAttributeValueSet.addLink(fieldNum(DimensionAttributeValueSet,RecId),
fieldNum(ITLRESPrincipalDisbursementSchedule,DefaultDimension));

qbdsDimensionAttributeValueSetItem = qbdsDimensionAttributeValueSet.addDataSource(tableNum(DimensionAttributeValueSetItem),"DimensionAttributeValueSetItem");
qbdsDimensionAttributeValueSetItem.addLink(fieldNum(DimensionAttributeValueSet,RecId),
fieldNum(DimensionAttributeValueSetItem,DimensionAttributeValueSet));

qbdsDimensionAttributeValue = qbdsDimensionAttributeValueSetItem.addDataSource(tableNum(DimensionAttributeValue),"DimensionAttributeValue");
qbdsDimensionAttributeValue.addLink(fieldNum(DimensionAttributeValue,RecId),
fieldNum(DimensionAttributeValueSetItem,DimensionAttributeValue));

qbdsDimensionAttribute = qbdsDimensionAttributeValue.addDataSource(tableNum(DimensionAttribute), "DimensionAttribute");
qbdsDimensionAttribute.addLink(fieldNum(DimensionAttribute,RecId),
fieldNum(DimensionAttributeValue,DimensionAttribute));
{
info(DimensionAttribute.Name+"----"+ DimensionAttributeValueSetItem.DisplayValue);
}
}

////////////////////////////////////////////////////////////////

my select query look like below---

select * from ITLRESPrincipalDisbursementSchedule
join RecId from DimensionAttributeValueSet
where DimensionAttributeValueSet.RecId == ITLRESPrincipalDisbursementSchedule.DefaultDimension
join RecId, DisplayValue from DimensionAttributeValueSetItem
where DimensionAttributeValueSetItem.DimensionAttributeValueSet == DimensionAttributeValueSet.RecId
join RecId from DimensionAttributeValue
where DimensionAttributeValue.RecId == DimensionAttributeValueSetItem.DimensionAttributeValue
join RecId, Name from DimensionAttribute
where DimensionAttribute.RecId == DimensionAttributeValue.DimensionAttribute;

Q about some terms in AIF like EntityKey[]

$
0
0

Hello ..

when i search about hot to call read operation in AIF services or write i found a lot of example ..

my problem to understand some terms like..

        EntityKey[] keys;
        EntityKey key = new EntityKey();
        KeyField fld = new KeyField();


and other wrote the code like 

            EntityKey[] readRespKeys = new EntityKey[1];
            readRespKeys[0] = new EntityKey();
            readRespKeys[0].KeyData = new KeyField[1];
            readRespKeys[0].KeyData[0] = new KeyField();
            readRespKeys[0].KeyData[0].Field = "TransferId";

in the previous code there  new EntityKey[1] and  new EntityKey() what is different between the two

other term is 

            // Create the service client proxy
            InventTransferOrderServiceClient client = new InventTransferOrderServiceClient();


there is comment Said client proxy . is it to open connection to AX service  

last thing is 

            // Add the result to the entity key value.

            readRespKeys[0].KeyData[0].Value = Console.ReadLine();


what entity key and key field means .

thank you

How to store value in aifentitykey in AX X++

Integrating Azure AppInsight in ax2012

$
0
0

I am unable to integrate Azure AppInsight in ax2012. Is it really possible to use Azure AppInsight in ax2012 and it is possible then how to do it.

Form validate event handler not marking field if called directly

$
0
0

Hi,

When creating event handler on form data field I'm able to get the Warning indicator shown on the field, like with this demo code:

[SubscribesTo(classStr(FormRun), staticDelegateStr(FormRun, onFormRun))]
public static void FormRun_onFormRun(FormRun _formInstance)
{

    if (_formInstance.form().name == "CustTable")
    {
        FormDataObject dataObject = _formInstance.dataSource("DirPartyTable_DirOrganization").object(fieldName2Id(tableNum(DirOrganization), "OrgNumber"));

        dataObject.OnValidating += eventhandler(MyEventHandlers::OrgNumber_OnValidating);
    }
}

public static void OrgNumber_OnValidating(FormDataObject _sender, FormDataFieldEventArgs _e)
{
    if (_sender.getValue() != "1010")
    {
        error("OrgNumber Error");
        FormDataFieldCancelEventArgs eventargs = _e;
        eventargs.cancel(true);
    }
}

But calling validate() directly from code does NOT show the warning indication on the field like: (and yes the same event handler as above gets called when calling validate())

public static void FormButtonControl1_OnClicked(FormControl sender, FormControlEventArgs e)
{
    FormDataObject fdo = sender.formRun().dataSource("DirPartyTable_DirOrganization").fieldName2Id(tableNum(DirOrganization), "OrgNumber")
    if (fdo)
    {
        fdo.validate();
    }
}

What am I missing?

I need to show the warning indicator on different forms without having the user to edit the field first.

Regards, Jorgen Dam

Viewing all 17532 articles
Browse latest View live


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