Skip to main content

validateWrite() in Dynamics AX 2012

public boolean validateWrite()
{
    boolean ret=true;
    HCMJob                  _HCMJob;
    HcmPositionDetail       _HcmPositionDetail;
    int                     _diff;
    ;
   
    select * from _HCMJob where _HCMJob.RecId == HRMRecruitingTable.Job;
    select   count(recId) from _HcmPositionDetail   where _HcmPositionDetail.Job == HRMRecruitingTable.Job;
    _diff = _HCMJob.MaximumPositions-_HcmPositionDetail.RecId;
   
   if (HRMRecruitingTable.qty>_diff)
    {
        ret = false;
    }

  if (ret)
    {
        ret = super();
    }
    else
    {
    if (HRMRecruitingTable.qty>_diff)
       {
            info("You cannot Add Any Opening");
       }
       else
       {
            info("You Cannot Add more than " + int2str( _diff )+ " Opening");
       }
    }
    return ret;
}

Comments