Wednesday, December 9, 2015

X++ code to change the table field properties

static void Esh_Test(Args _args)
{
 str myProp,myProp1;

 #AOT


 NumberSequenceList   numberSequenceList; //Table Name

 TreeNode            numSeqFldsRoot = treeNode::findNode(@"\Data Dictionary\Tables\NumberSequenceList\Fields\Status"); //Field Path

 TreeNode           numSeqFldsRoot1 = treeNode::findNode(@"\Data Dictionary\Tables\NumberSequenceList\Fields\TransId"); //Field Path

 TreeNode           table = treeNode::findNode(@"\Data Dictionary\Tables\NumberSequenceList"); //Table Path

;


  numSeqFldsRoot.AOTsetProperties("PROPERTIES\n AllowEdit #" + 'No' + "\n ENDPROPERTIES\n"); // We use AOTsetProperties method to  set or manipulate the field properties.


  numSeqFldsRoot1.AOTsetProperties("PROPERTIES\n AllowEdit #" + 'No' + "\n ENDPROPERTIES\n");



  myProp = numSeqFldsRoot1.AOTgetProperties();
  myProp1 = numSeqFldsRoot.AOTgetProperties();

  numSeqFldsRoot.AOTsave();
  numSeqFldsRoot1.AOTsave();
  table.AOTsave(); // Saving the table.

  info(myProp);
  info(myProp1);
   
 
}

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...