Skip to main content

Select Parent-Child Lines On Form

 

While working on forms if we get any requirement for select and deselect parent-child lines for e.g:

1. if parent record is selected then its child record should be selected automatically on the same form.

2. if child record is selected then its parent record should also be selected automatically on the same form.



[ExtensionOf(Formstr(SalesCopying))]
final class SalesCopying_Extension
{
/// <summary>
/// On Modified select child lines of the parent lines
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[formcontroleventhandler(formcontrolstr(salescopying, custinvoicetrans_copy), formcontroleventtype::modified)]

public static void custinvoicetrans_copy_onmodified(formcontrol sender, formcontroleventargs e)
{
custinvoicetrans custinvoicetrans;
formcheckboxcontrol parentcheckbox, childcheckbox;
formdatasource custinvoicetrans_ds;
int ismarked;
formcontrol formcontrol = sender as formcontrol;
custinvoicetrans_ds = formcontrol.formrun().datasource(tablestr(custinvoicetrans));
parentcheckbox = formcontrol.formrun().design(0).controlname("custinvoicetrans_copy");
ismarked = parentcheckbox.value();
custinvoicetrans_ds.next();
childcheckbox = formcontrol.formrun().design(0).controlname("custinvoicetrans_copy");
custinvoicetrans = custinvoicetrans_ds.cursor();
if(ismarked== 1)
{
childcheckbox.checked(1);
custinvoicetrans_ds.markrecord(custinvoicetrans, ismarked);
}
else
{
childcheckbox.checked(0);
custinvoicetrans_ds.markrecord(custinvoicetrans, ismarked);
}

custinvoicetrans_ds.refresh();
}
}




HEY HEY HEY!!!! HACK OF THE DAY!!!
If you want to call form standard function into event handler then implement event handler in form extension class. 

Comments

Popular posts from this blog

Edit Method on Form

Edit Method D365 for a form Data Source 1. To create an edit method first create a controller class. with following properties  public static edit MainAccountNum LedgerJournalTransLedger(LedgerJournalTrans _ledgerjournal, boolean _set, MainAccountNum _id) { MainAccountNum accountId = _id; MainAccount mainAccount = MainAccount::findByMainAccountId(_id); if(_set) { if(_ledgerjournal.AccountType== LedgerJournalACType::Ledger) { mainAccount = MainAccount::findByMainAccountId(accountId); if(_ledgerjournal.LedgerDimension) { DimensionDefault defaultDim = LedgerDimensionFacade::getDefaultDimensionFromLedgerDimension(_ledgerjournal.LedgerDimension); _ledgerjournal.LedgerDimension = LedgerDimensionDefaultingEngine::getLedgerDimensionFromAccountAndDim(mainAccount.RecId, DimensionHierarchy::getAccountStructure(mainAccount.RecId), defaultDim); } else { _ledgerjournal.LedgerDimension = LedgerDimensionDefaultingEngine::getLedgerDimensionFromAccountAndDim(mainAccount.RecId, DimensionHierarchy::ge...

Field Level Security In Ax 2012

FIELD LEVEL SECURITY IN AX 2012 In this blog we will discuss field level security applied in  Ax 2012. 1. Field level security is added on form level as well in Ax 2012 its bit different then field level security in D365 2. This also requires privileges to be applied on form specific fields only. Step #1 :  Change datasource property of the field which need to be added in security. Step #2 : Now add these 2 fields in form --- > permissions --- > Read Step #3 : Now finally create privilege and add these fields explicitly in it.       HEY HEY HEY !!!! HACK OF THE DAY  Add Fields in Entry point privilege section of form  Explicitly.  

Security Objects In D365

   PRIVILEGES, DUTIES AND ROLES IN D365 FinOps To add customize security privilege, duty and role you should follow this flow because it is considered as the best practices  Role---> Duty---->Privilege Duty and Privilege would be created at the back end and where as role would be created at front end  1. create privilege from solution explorer in a project  and add new entry point for output, display or action menus to refer in privilege that for which entity we have to give privilege to the user 3. Now Create a duty from solution explorer same as privilege and add this new created privilege to the duty  Now you can refer this duty to the role created on the front end.   HEY HEY HEY !!!! HACK OF THE DAY !!           THE HIGHEST ACCESS LEVEL  FOR ACTION MENU ITEM IS   DELETE