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

Select a record type to create Listpage d365 f&o

$
0
0

hi all,

i have created a list page it is throwing a pop up window when i run the list page kindly help me .

the messgae is Select a record type to create 

thank you .


how can I pass list of object to data contract

$
0
0

Hello expert please i need help to pass list of object to data contract

first, i create a data contract

[DataContract('Colors')]
class ColorDataContract
{
    Name colorName;
    DataAreaId dataAreaId;
    [DataMember]
    public Name parmColorName(Name _colorName = colorName)
    {
        colorName = _colorName;
        return colorName;
    }
}

second, create a service class

class ColorService
{
    public void InsertColor(ColorDataContract colorObj)
    {
        ColorsTable _color;
        Name _name;
        _name = colorObj.parmColorName();
        ttsbegin;
        _color.Name = _name;
        _color.insert();
        ttscommit;
        }
    }
    public void insertColorList(List colorList)
    {
        ListIterator iterator;
        ListEnumerator enumerator;
        ListIterator literator;
        ColorDataContract colorDataContract;
        enumerator = colorList.getEnumerator();
        while(enumerator.moveNext())
        {
            colorDataContract = enumerator.current();
            if(colorDataContract != null)
            {
                this.InsertColor(colorDataContract);
            }
        }
    }

}

after that, I create a new service group and service and assign the method to the service, etc. everything until this point is working fine

In the code below i try to consume custom service in json using the Microsoft simple integration

github.com/.../d365fo.integrations

my problem is how to pass the list to my contract into JSON
i can pass data to insertColor method without any issue my problem with insertColorList method

static void Main(string[] args)
        {
            string sessionUrl = "/api/services/XXXServices/XXXColors/insertColorList";
            string GetUserSessionOperationPath = string.Format("{0}{1}", ClientConfiguration.Default.UriString.TrimEnd('/'), sessionUrl);
            var request = HttpWebRequest.Create(GetUserSessionOperationPath);

            //how to pass the list to my service
            
            
            //Post one color
            //var con = new ArafaContractList();
            //con.parmColorName = "Blue";

            //var contract = new { colorObj = con };

            string json = JsonConvert.SerializeObject(contract);
            Byte[] byteArray = Encoding.UTF8.GetBytes(json);
            request.Headers[OAuthHelper.OAuthHeader] = OAuthHelper.GetAuthenticationHeader(true);
            request.Method = "POST";
            request.ContentLength = byteArray.Length;
            request.ContentType = "application/json";

            using (var stream = request.GetRequestStream())
            {
                stream.Write(byteArray, 0, byteArray.Length);
            }

            using (var response = (HttpWebResponse)request.GetResponse())
            {
                using (Stream responseStream = response.GetResponseStream())
                {
                    using (StreamReader streamReader = new StreamReader(responseStream))
                    {
                        string responseString = streamReader.ReadToEnd();

                        Console.WriteLine(responseString);
                    }
                }
            }

            Console.ReadLine();
        }

How to create a Computed field in View?

$
0
0

Hi. I'm making a view, and I have some questions.

I made a view showing the label of enum.

but, it's showing the label of english.

I want to show Korean labels.

What should I do?

my source code

    public static server str genderString()
    {
        tableName viewName = identifierStr(salesLineTestView);
        DictEnum dictEnum = new DictEnum(enumNum(SalesStatus));
        Map enumValues = new Map(Types::String, Types::String);
        int n;
        for (n = 0; n < dictEnum.values(); n++)
        {
            enumValues.insert(int2Str(dictEnum.index2Value(n)), SysComputedColumn::returnLiteral(dictEnum.index2Symbol(n)));
        }
        return SysComputedColumn::switch( SysComputedColumn::returnField( viewName, identifierStr(SalesTable), fieldStr(SalesTable, SalesStatus)), enumValues, SysComputedColumn::returnLiteral(dictEnum.index2Symbol(n)));
    }

How can i pass list of object and return this list in custom service

$
0
0

Hello expert, I need some help to pass a list of object and return it

1- Create data contract 

[DataContract('Customers')]
class AHCustomerDataContract
{
    AccountNum  accountNum;
    Name        custName;

    [DataMember('AccountNum')]
    public AccountNum parmAccountNum(AccountNum _accountNum = accountNum)
    {
        accountNum = _accountNum;
        return accountNum;
    }

    [DataMember('CustName')]
    public Name parmCustName(Name _custName = custName)
    {
        custName = _custName;
        return custName;
    }

    protected void new()
    {
    }

    private static AHCustomerDataContract construct()
    {
        return new AHCustomerDataContract();
    }

    public static AHCustomerDataContract newFromTableRecord(CustTable   _custTable)
    {
        AHCustomerDataContract  contract = AHCustomerDataContract::construct();

        contract.parmAccountNum(_custTable.AccountNum);
        contract.parmCustName(_custTable.name());

        return contract;
    }

}

2- Create list data contract 

[DataContractAttribute]
class AHCustomerListDataContract
{
    List customerList;
    protected void new()
    {
        customerList = new List(Types::Class);
    }

    public static AHCustomerListDataContract construct()
    {
        return new AHCustomerListDataContract();
    }

    public void addCustomerToList(AHCustomerDataContract _customerDataContract)
    {
        customerList.addEnd(_customerDataContract);
    }

    [DataMember,AifCollectionType('return',Types::Class,classStr(AHCustomerDataContract))
        ,AifCollectionType('_custList',Types::Class,classStr(AHCustomerDataContract))
        ]
    public List parmCustomerList(List _custList = customerList)
    {
        customerList = _custList;
        return customerList;
    }

}

3- Create service class

[AifCollectionTypeAttribute('customerList',Types::Class,classStr(AHCustomerDataContract))]
    public AHCustomerListDataContract getCustomerList(List customerList)
    {
        ListIterator    iterator;
        ListEnumerator  enumerator;
        ListIterator    literator;
        AHCustomerListDataContract  customerListDataContract = AHCustomerListDataContract::construct();
        AHCustomerDataContract      customerContract;

        enumerator = customerList.getEnumerator();

        while(enumerator.moveNext())
        {
            customerContract = enumerator.current();

            if(customerContract != null)
            {
                customerContract = AHCustomerDataContract::newFromTableRecord(CustTable::find(customerContract.parmAccountNum()));
                customerListDataContract.addCustomerToList(customerContract);
            }
        }
        return customerListDataContract;
    }

4- consume the service in JSON

static void Main(string[] args)
    {
        GetCustomerList();
    }
class AHContract
    {
        public string parmAccountNum { get; set; }
        public string AccountNum { get; set; }
    }

public static void GetCustomerList()
        {
            // In the AOT you will find UserSessionService in Service Groups and AifUserSessionService under Services.
            string sessionUrl = "/api/services/AHServices/CustomerServices/getCustomerList";
            string GetUserSessionOperationPath = string.Format("{0}{1}", ClientConfiguration.Default.UriString.TrimEnd('/'), sessionUrl);
            var request = HttpWebRequest.Create(GetUserSessionOperationPath);

            List<AHContract> custList = new List<AHContract>
            {
                new AHContract{AccountNum = "US-001"},
                new AHContract{AccountNum = "US-003"}
            };

            var contract = new { customerList = custList };

            string json = JsonConvert.SerializeObject(contract);
            Byte[] byteArray = Encoding.UTF8.GetBytes(json);
            request.Headers[OAuthHelper.OAuthHeader] = OAuthHelper.GetAuthenticationHeader(true);
            request.Method = "POST";
            request.ContentLength = byteArray.Length;
            request.ContentType = "application/json";

            using (var stream = request.GetRequestStream())
            {
                stream.Write(byteArray, 0, byteArray.Length);
            }

            using (var response = (HttpWebResponse)request.GetResponse())
            {
                using (Stream responseStream = response.GetResponseStream())
                {
                    using (StreamReader streamReader = new StreamReader(responseStream))
                    {
                        string responseString = streamReader.ReadToEnd();

                        Console.WriteLine(responseString);
                    }
                }
            }

            Console.ReadLine();
        }

My problem is I get only the transaction related to customer US-003

Thank's in advance 

add a field to an extended form from application suite form

$
0
0

Hi,

I want to add a field from a data source which is not included in the form data source currently. I tried to extend the form and add a data source but it is not possible as the original form is application suite form. 

How to add a new field from non-listed data source to the application suite form?

Thank you. 

How to verify temporary tables on the sql server.

$
0
0

Hi Experts,

I couldn't find any other temporary tables on the sql server in D365FO referring to URL as below,

Difference between InMemory and TempDB tables in D365 F&O – Dynamics 365 Finance & Operations (14-dynamics365.com)

Is it possible to see the data of temporary tables using ssms?

Could anyone tell me It's possible to verify and see data of temporary table to have table type is TempDB?

Otherwise, Is it difficult to see data of temporary tables on the sql server?  Actually, I have never seen temporary tables on AXDB.

Thanks in advance.

Is it possible to use X++ methods for computed field methods?

$
0
0

Hi

I would like to use the following X++ method as a computed field method of data entity. Is it possible?

HcmWorker::findByPerson(DirPersonUser::find(SourceDocumentLine.CreatedBy).PersonParty).PersonnelNumber;

Can it be used only in virtual fields?
If it is available, please guide me how to use it.

Thanks.

How to access form controls in a job

$
0
0

Hi,

I have created a form which is having one integeredit control which is for number of days,and a button control. I need to get the values from the integeredit control and to use in a x++ job. Help me on this.

Regards,

Ram


Purchase Requisition Closed status - X++ Extension

$
0
0

Hello everyone,  my goal is to implement COC when the PurchReqTable.RequisitionStatus is equal to "Closed"(I want to implement Chain of Command after the update for PurchReqTable.RequisitionStatus)

I don't know which method or class should I use in order to trace the code. It looks like a background process handles the code when I click the Approve button because

after a minute or two the status will be updated from Approved to Closed. I tried the setPurchReqTableByBudgetReservationReference method from  PurchReqWFStatusTransitionHelper class but my code didn't work

[ExtensionOf(classStr(PurchReqWFStatusTransitionHelper))]
final class PurchReqWFStatusTransitionHelper_Extension
{
    public static void setPurchReqTableByBudgetReservationReference(RecId _purchReqTableRecId, boolean _doVersioning)
    {
        next setPurchReqTableByBudgetReservationReference(_purchReqTableRecId, _doVersioning);
        PurchReqRequisitionStatus   toRequisitionStatus;
        toRequisitionStatus = PurchReqTable::evaluateHeaderStatus(_purchReqTableRecId, PurchReqRequisitionStatus::Closed);
        if(toRequisitionStatus == PurchReqRequisitionStatus::Closed)
        {
            info("Closed COC Requisition status");
        }
    }

}



Thanks in advance

How to generate T-SQL code for tables method?

$
0
0

Hi

I would like to get the PersonnelNumber field value  of the HcmWorker table using a computed column without adding a data sources to the data entity.

I have SourceDocumentLine.CreatedBy in my data entity filed.

In the virtual column, I can get the value by the following method.

HcmWorker::findByPerson(DirPersonUser::find(SourceDocumentLine.CreatedBy).PersonParty).PersonnelNumber;

However, I don't want to use virtual column because I want to export the data to Azure SQL DB(BYODB).
But I don't know how to generate T-SQL code for findByPerson and find methods.

Please, let me know.

team Work item number in D365Fo

$
0
0

Hi all,

1. I have an one work item number.

2. how to get that workitem number in the Query (query means teams<new query>)

I don't know how to do in the teams query. could you please give me some snap for that?

Thanks 

Simple Query - SalesLine and SalesTable relation

$
0
0

Hi All,

It seems that there is a 1:N relation between SalesTable.SalesId and SalesLines.SalesId. 

When I create a simple query, can I also add SalesLine  as a child data source of SalesTable ? or should it be always the case that the SalesTable is the child data source of the SalesLine in the query if I want to relate these two tables each other? 

Thank you. 

How to read value having comma(,) in the column while reading CSV file - AX 2009

$
0
0

Hi All,


We are trying to read one column from CSV file having comma(,) in the value like "Abc,def" , but while reading this column it is dividing into 2 columns like "Abc" and "def"  instead one value like Abc,def.


Any solution to avoid this type of issue, please advice us.


Regards,


Akbar

find delay date if I have only 1 date column in query based report(ssrs)

$
0
0

find delay date if I have only 1 date column in query based report(ssrs) and i column of issue date 

if product is ship so the "column of issue date =0" and when procut is received so the "column of issue date =1"

how to differ date(of delay time)

Create View with field from display method

$
0
0

Hi guys,

Is there a possibility to create View which is the field is from a display method ?

So I create View, lets say the data source is table A and apart from adding fields from table A's field, I also want to have a field that displaying table A's display method.

A sample view from Ax is BankAccountView :

So in this example BankAccountView, I would like the "getBankAccountBalanceCur" to be one of the field.

This is actually related to my other post (+) Relation between ProjTransPosting and ProjPostTransView - Dynamics 365 Finance Forum Community Forum, but it  can be separated so not really matters as the point is still "can we have a field of a View based on a display method ?"

Thanks,


Dialog - how to remove the side bar

$
0
0

Hi All,

I am using a form pattern: Dialog - Basic and changed some of control's widthmode (to Manual) and width. Then depending on Zoom level, 

it shows the following bar.. How can we configure not to show this bar regardless of the zoom level?

Thank you. 

"Query used" defaults

$
0
0

Hi all,

Running AX 2012 R3 CU9.

When running confirmations, pick lists, etc - is it possible to change the values within "Query used" defaults?

I'm aware you can save the values in a selection as a separate query but that's reliant on usage data not being deleted, and as far as I know you can't make a custom query the default.

Presumably it must be getting the data for the default ranges from somewhere, is there a way we can slip in a few extra fields in the default "Query used" selection without breaking base classes?

Thanks very much in advance,

Luke

Loading and selecting from an in-memory table

$
0
0

Dear Dynamics community,

I could use your assistance completing an issue I'm having when attempting to load a temporary in-memory table from a List.
The behavior that I've noticed is that when I set the temporary table I'm only able to load a single object from the list; when I attempt to load multiple objects an error is thrown (as I would expect the List to be dynamic, and more than two objects in the list will typically be expected).  Is there a method or process where I might load multiple objects of the same type into a temporary table on which to perform a select from?

Currently my code is set up as follows:

private BRKContractHeader finalListReduction(List contracts)
    {
        BRKContractHeader bestContract;
        BRKContractLine bestContractLine;
        BRKShippingScenario bestShippingScenario;
        bestContract.setTmp();

        ListEnumerator enumerator = contracts.getEnumerator();

        while(enumerator.moveNext())
        {
            BRKContractHeader header = enumerator.current();

            bestContract.setTmpData(header);
            bestContract.doInsert();
        }

Furthermore the method continues and I attempt a 'select' against the existing information I expect to be loaded into the temp table:

select bestContract
            join bestContractLine 
            join bestShippingScenario 
        order by bestContract.ContractId desc
            , bestContractLine.ContractLine desc
            , bestShippingScenario.ShippingScenarioLine desc
        where bestContract.ContractId == bestContractLine.ContractId&& bestContract.ContractId == bestshippingScenario.ContractId&& bestContractLine.ContractLine == bestShippingScenario.ContractLine&& bestContractLine.FreightResponsibility == BRKFreightResponsibility::DJJ
        {
            bestContract = bestContract;   
        }

        
        return bestContract;
    }

Ideally I would like to be able to load multiple records into the header table, find the corresponding line and shippingScenarios information, in order to whittle down the list to where only a few (ideally one) contract would remain.

Your help, as always, is much appreciated.  Happy St. Valentine's Day to you all!

Is Update_recordset skip Update() method ?

$
0
0

Hi guys,

As mentioned, when we use Update_recordset, does it skip Update method() ? I created Job and use Update_Recordset then create CoC class with Update method of the same table, however it never run my CoC class.

Actually I ran to a post saying it is run Update(), I just want to confirm, which one is true ?

I didn't specify anything else, btw, like SkipDataMethod or SkipEvents.

Thanks,

Field Known as not visible from table Global address book?

$
0
0

Hi, 

Hope you are doing all well!

l am having an issue with "Known as" field from table Global address book. l am a system administrator and this field is visible and can be added as a new column in All Customers view. (as in the screenshot below)

But my colleague which is also System Administrator can not add this field. It is not visible, (as in the screenshot below).

We cleared the usage data, we deleted the user of my colleague and created it same as my user, and checked everything that crossed on our minds but without solution. 

Can you please help on this?

Viewing all 17532 articles
Browse latest View live


Latest Images

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