Emploee Lookup – Legal entity specific – Active Emploee

0

Sample Code to generate Employee Lookup . Which contains Active employee, Legal entity specific and here i have an extra filter to exclude workers starting from 00.

You can also use the same code to get the Terminated employee just by Slight change in the query .

public void lookup()
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup;

QueryBuildDataSource queryBuildDataSource1;
RecId _LegalEntity;
;

//Create an instance of SysTableLookup with the form control passed in
sysTableLookup = SysTableLookup::newParameters(tablenum(HcmWorker), this);

//Add the fields to be shown in the lookup form
sysTableLookup.addLookupfield(fieldnum(HcmWorker, PersonnelNumber), false);
sysTableLookup.addLookupMethod(‘Name’);

//create the query datasource
queryBuildDataSource = query.addDataSource(tablenum(HcmWorker));
queryBuildDataSource.addRange(fieldNum(HcmWorker, PersonnelNumber))
.value(SysQuery::valueLikeAfter(‘!00’));

queryBuildDataSource1 = queryBuildDataSource.addDataSource(tableNum(HcmEmployment));
queryBuildDataSource1.joinMode(JoinMode::ExistsJoin);
queryBuildDataSource1.relations(true);
queryBuildDataSource1.addRange(fieldNum(HcmEmployment, LegalEntity))
.value(SysQuery::value(CompanyInfo::findDataArea(SelectableDataArea.valueStr()).recId));

//add the query to the lookup form
sysTableLookup.parmQuery(query);

// Perform lookup
sysTableLookup.performFormLookup();

}

Advertisements

Run RDP based report from Code & passing parameter using Data contract

0

Bsic Code to run RDP based report using x++ and passing parameters to data contract.

SrsReportRunController controller = new SrsReportRunController();
VendSOAReportTmpContract rdpContract = new VendSOAReportTmpContract ();
SRSPrintDestinationSettings settings;

 

controller.parmReportName(ssrsReportStr(VendSOATmpReport,PrecisionDesign));

controller.parmShowDialog(false);
rdpContract.parmVendAccount(VendPurchOrderJour.OrderAccount);
controller.parmReportContract().parmRdpContract(rdpContract);
controller.startOperation();

Step name of Workflow

0

Below is the reference sample code to get the workflow step name.

public display str 25 stepName(PurchReqTable _purchReqTable)
{
container con;
PurchReqTable purchReqTable;
PurchReqTableHistory purchReqTableHistory;
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable workflowTracking;
utcdatetime validDate = DateTimeUtil::utcNow();
WorkflowStepName stepName;
TransDate stepSinceDate;
PurchReqRequisitionStatus status;
TransDate statusSinceDate;
RefRecId workflowTrackingStatusRecId;
RefRecId workflowStepRecId;
UserInfo userInfo;
WorkflowTrackingTable workflowTrackingLocal,workflowTrackingLocal2,workflowTrackingLocal3;
WorkflowStepTable workflowstepTable;
RefRecId _purchReqTableRecId = _purchReqTable.RecId;

/* Get the current status */
select firstonly validTimeState(validDate)
CreatedDateTime, RequisitionStatus from purchReqTable
where purchReqTable.RecId == _purchReqTableRecId

outer join CreatedDateTime from purchReqTableHistory
where purchReqTableHistory.PurchReqTable == purchReqTable.RecId

outer join RecId from workflowTrackingStatus
order by workflowTrackingStatus.CreatedDateTime desc
where workflowTrackingStatus.ContextTableId == purchReqTable.TableId &&
workflowTrackingStatus.ContextRecId == purchReqTable.RecId;

/* line-item subworkflow */
select firstonly RecId, Name, CreatedDateTime, TrackingContext, TrackingType,WorkflowElementTable,WorkflowTrackingStatusTable,WorkflowStepTable from workflowTracking
order by workflowTracking.CreatedDateTime desc
where workflowTracking.WorkflowTrackingStatusTable == workflowTrackingStatus.RecId;
if (workflowTracking.TrackingContext != WorkflowTrackingContext::LineItemElement ||
workflowTracking.TrackingType != WorkflowTrackingType::Creation)
{
/* Current step */
select firstonly RecId, Name, CreatedDateTime, TrackingContext, TrackingType,WorkflowElementTable,WorkflowTrackingStatusTable,WorkflowStepTable from workflowTracking
order by workflowTracking.CreatedDateTime desc
where workflowTracking.WorkflowTrackingStatusTable == workflowTrackingStatus.RecId &&
workflowTracking.TrackingContext == WorkflowTrackingContext::Step &&
workflowTracking.TrackingType == WorkflowTrackingType::Creation;
}

if (purchReqTable != null)
{
status = purchReqTable.RequisitionStatus;
userInfo = xUserInfo::find(false, curUserId());

if (purchReqTableHistory != null)
{
statusSinceDate = DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(purchReqTableHistory.CreatedDateTime, userInfo.PreferredTimeZone));
}
else
{
statusSinceDate = DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(purchReqTable.CreatedDateTime, userInfo.PreferredTimeZone));
}

if (workflowTracking != null)
{
stepName = workflowTracking.Name;
stepSinceDate = DateTimeUtil::date(workflowTracking.CreatedDateTime);
workflowTrackingStatusRecId = workflowTrackingStatus.RecId;
workflowStepRecId = workflowTracking.WorkflowStepTable;
}
select firstOnly workflowTrackingLocal
where workflowTrackingLocal.TrackingType == WorkflowTrackingType::Return &&
workflowTrackingLocal.WorkflowElementTable == workflowTracking.WorkflowElementTable &&

workflowTrackingLocal.WorkflowTrackingStatusTable == workflowTracking.WorkflowTrackingStatusTable &&
workflowTrackingLocal.RecId > workflowTracking.RecId;

if (workflowTrackingLocal)
{
select firstOnly workflowTrackingLocal2
where workflowTrackingLocal2.TrackingType == WorkflowTrackingType::Creation &&
workflowTrackingLocal2.TrackingContext == WorkflowTrackingContext::Step &&
workflowTrackingLocal2.WorkflowElementTable == workflowTrackingLocal.WorkflowElementTable &&
workflowTrackingLocal2.WorkflowStepTable == workflowTracking.WorkflowStepTable &&
workflowTrackingLocal2.WorkflowTrackingStatusTable == workflowTrackingLocal.WorkflowTrackingStatusTable &&
workflowTrackingLocal2.RecId > workflowTrackingLocal.RecId;
}
if (!workflowTrackingLocal2)
{

 

select firstOnly workflowTrackingLocal2
where workflowTrackingLocal2.TrackingType == WorkflowTrackingType::Creation &&
workflowTrackingLocal2.TrackingContext == WorkflowTrackingContext::Task &&
workflowTrackingLocal2.WorkflowElementTable == workflowTrackingLocal.WorkflowElementTable &&
workflowTrackingLocal2.WorkflowStepTable == workflowTracking.WorkflowStepTable &&
workflowTrackingLocal2.WorkflowTrackingStatusTable == workflowTrackingLocal.WorkflowTrackingStatusTable &&
workflowTrackingLocal2.RecId > workflowTrackingLocal.RecId;

}

if (workflowTrackingLocal2 != null)
{

workflowstepTable = workflowstepTable::findRecId(workflowTrackingLocal2.WorkflowStepTable);
stepName = workflowstepTable.Name;
stepSinceDate = DateTimeUtil::date(workflowTrackingLocal2.CreatedDateTime);
workflowTrackingStatusRecId = workflowTrackingLocal2.WorkflowTrackingStatusTable;
workflowStepRecId = workflowTrackingLocal2.WorkflowStepTable;
}

}

return stepName;
}

Go to origin \ Custom button on Info

0

Just a quick code to add a button on InfoLog to facilitate user to go directly on the respective message record.

OutPut: 

rfq-img

 

Code :

img-2

 

SysInfoAction_MenuFunction        sysInfoAction; //Class which we have to use to create a Button.
purchRFQCaseTable       purchRFQCaseTable; // Declaration of buffer
purchRFQCaseTable = purchRFQCaseTable::find(‘RFQ-0001’);

sysInfoAction = SysInfoAction_MenuFunction::newMenuItem(menuitemDisplayStr(PurchRFQCaseTable),MenuItemType::Display); // here we create a button Link with the menu Item of the form to open on click event
sysInfoAction.parmCallerBuffer(purchRFQCaseTable); //passing buffer on the form
info (strfmt(“@SYS107925″, purchRFQCaseTable.rfqCaseId),”, sysInfoAction); // creating info with desired button