close
 Dynamics AX has standard functionality to show a prompt for any common fields on Sales Header & Lines are being updated on header.
 
AX
 

salesTable2LineUpdate_1.PNG

Dynamic 365
 
This prompt is based on the setup done on the AR Parameters form -> Updates -> Update order lines button
 
AX

salesTable2LineUpdate_2.PNG

 

salesTable2LineUpdate_3.PNG

 
 
If we want to have our custom field to behave in same manner, then we need to do following steps.
 
1. Create your new field on the SalesTable & SalesLine tables. Here for I am going to use field as "AS_TitleTransfer"
2. Add the AS_TitleTransfer field to SalesTable field group HeaderToLineUpdate.
 
 
3. Add the new field on the Header & Lines section on SalesTable form like on General Tab.
4. In the AxSalesTable class add parm & set methods for new field.
 
public <<your EDT>> parmAS_TitleTransfer(<<your EDT>> _Id = '')
{
    if (!prmisDefault(_Id))
    {
        this.setField(fieldNum(SalesTable, AS_TitleTransfer), _Id);
    }
 
    return salesTable.AS_TitleTransfer;
 
}
 
 
protected void setAS_TitleTransfer()
{
    if (this.isMethodExecuted(funcName(), fieldNum(SalesTable, AS_TitleTransfer)))
    {
        return;
    }
 
}
 
In the SetTableFields method add the below mentioned line of code.
 
this.setAS_TitleTransfer();
 
5. Similarly write the parm & set methods for AxSalesLine class. Here we need to tweak set method here.
 
public <<your EDT>> parmAS_TitleTransfer(<<your EDT>> _id = '')
{
    if (!prmisDefault(_id))
    {
        this.setField(fieldNum(SalesLine, AS_TitleTransfer), _id);
    }
 
    return SalesLine.AS_TitleTransfer;
 
}
 
protected void setAS_TitleTransfer()
{
    if (this.isMethodExecuted(funcName(), fieldNum(SalesLine, AS_TitleTransfer)))
    {
        return;
    }
 
    this.setAxSalesTableFields();
 
    if (this.isAxSalesTableFieldsSet() || this.axSalesTable().isFieldModified(fieldNum(SalesTable, AS_TitleTransfer)))
    {
        this.parmAS_TitleTransfer(this.axSalesTable().parmAS_TitleTransfer());
    }
 
}
 
In the SetTableFields method add the below mentioned line of code.
 
this.setAS_TitleTransfer();
 
6. In the SalesTable2LineField class modify the method lineUpdateDescription with following code
 
case fieldNum(SalesTable, AS_TitleTransfer) :
                return fieldid2pname(tablenum(SalesLine), fieldnum(SalesLine, AS_TitleTransfer));
 
7. Compile & compile forward as modified classes & do the incremental CIL. Clear the usage data so that new field should appear in the AR Parameters form -> Updates -> Update order lines form.
 
8. You can test your changes in the Sales Order form now by entering the date on header & click on line view to get prompt.
 
arrow
arrow

    lionlionchopper 發表在 痞客邦 留言(0) 人氣()