Posts

Showing posts from December, 2024

insert PO Charges in d365fo x++

insert PO Charges in d365fo x++ Code: public void insertPOCharges(VendPurchOrderJour _vendPurchOrderJour) { PurchLineAllVersions PurchLineAllVersions; MarkupTransHistory MarkupTransHistory; MarkupTrans MarkupTrans; MarkupTable MarkupTable; PURCHLINE PURCHLINE; PurchTableVersion PurchTableVersion; select PurchTableVersion where PurchTableVersion.RecId == _vendPurchOrderJour.PurchTableVersion; utcdatetime dateTime = PurchTableVersion.VersionDateTime; if (PurchTableVersion.IsArchived) { while select ValidTimeState(dateTime) sum(Value), MarkupCode from MarkupTransHistory join PURCHLINE where MarkupTransHistory.TRANSRECID == PURCHLINE.RECID && MarkupTransHistory.TransTableId == PURCHLINE.TableId join PurchLineAllVersions where PurchLineAl...

DSWFDetails Util d365fo x++

  DSWFDetails Util d365fo x++ Code: public class DSWFDetailsUtil { private static DSWFDetailsUtil wFDetailsUtilObj; public static DSWFDetailsUtil construct() { return (wFDetailsUtilObj) ? wFDetailsUtilObj : new DSWFDetailsUtil(); } public Name getSubmittedBy(TableId _tableId, RecId _recId) { UserInfo userInfo; WorkflowTrackingTable workflowTrackingTable; WorkflowTrackingStatusTable workflowTrackingStatusTable; select firstonly1 Name from userInfo order by workflowTrackingTable.CreatedDateTime desc exists join workflowTrackingTable exists join workflowTrackingStatusTable where userInfo.id == workflowTrackingTable.User && workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId && workflowTrackingTable.TrackingType == WorkflowTrackingType::Submission && workflowTrackin...

DSS Util d365fo x++

  DSS Util d365fo x++ Code: using System.Globalization; class DSSUtil { private static DSSUtil utilObject; public static DSSUtil construct() { if(!utilObject) { utilObject = new DSSUtil(); } return utilObject; } public str getNumberSequence(ExtendedTypeId _edt) { str numberSequenceID; SysLastValue sysLastValue; NumberSequenceReference numberSequenceReference = NumberSeqReference::findReference(_edt); NumberSequenceTable numberSequenceTable = NumberSequenceTable::find(numberSequenceReference.NumberSequenceId); if (numberSequenceReference && numberSequenceTable) { if(!numberSequenceTable.Manual) { NumberSeq numberSeq = NumberSeq::newGetNumFromId(numberSequenceTable.RecId,true,true,sysLastValue,false); numberSequenceID = (numberSeq) ? numberSeq.num() : ''; ...

DSPWorkflowUtil d365fo x++

DSPWorkflowUtil  d365fo x++ Code: class DSPWorkflowUtil { private static DSPWorkflowUtil workFlowUtilObject; public static DSPWorkflowUtil construct() { if(!workFlowUtilObject) workFlowUtilObject = new DSPWorkflowUtil(); return workFlowUtilObject; } void submit(Args args) { recId recId; Common record; str note; WorkflowTypeName workFlowType; WorkflowVersionTable workflowVersionTable; workflowVersionTable = args.caller().getActiveWorkflowConfiguration(); WorkflowType = workflowVersionTable.workflowTable().TemplateName; WorkflowSubmitDialog workflowSubmitDialog; workflowSubmitDialog = WorkflowSubmitDialog::construct(workflowVersionTable); record = args.record(); recId = record.RecId; ; if(!this.isValidToSubmit(record)) { error("@DSPLabel:DSP001247"); //Refresh caller f...

DSGNSUtil d365fo x++

DSGNSUtil  d365fo x++ Code: class DSGNSUtil { static str ansarHijriDate(date _transDate) { TransDate dt; int HijriDt; int HijriMonth; str Yr,finaldate; int findate; CalendarConverter CalendarConverter; str Hijridat,HijriMnth,HijriYr; ; dt = _transDate; CalendarConverter = new CalendarConverter(PreferredCalendar::Hijri); HijriDt = CalendarConverter.dayofmth(dt); HijriMonth = CalendarConverter.mthofyr(dt); Yr = CalendarConverter.yearStr(dt); Hijridat = int2str(HijriDt); HijriMnth = int2str(HijriMonth); HijriYr = Yr;//subStr(Yr,3,5);// Sub string is taken as i want to return only two digits of year finaldate = Hijridat + "/" + HijriMnth + "/" + HijriYr; return finaldate; } }

DSHRWorkflowUtil d365fo x++

DSHRWorkflowUtil  d365fo x++ Code: class DSHRWorkflowUtil { void submit(Args args) { recId recId; str note; WorkflowTypeName workFlowType; WorkflowVersionTable workflowVersionTable; workflowVersionTable = args.caller().getActiveWorkflowConfiguration(); WorkflowType = workflowVersionTable.workflowTable().TemplateName; WorkflowSubmitDialog workflowSubmitDialog; workflowSubmitDialog = WorkflowSubmitDialog::construct(workflowVersionTable); recId = args.record().RecId; ; workflowSubmitDialog.run(); if (workflowSubmitDialog.parmisClosedOK()) { note = workflowSubmitDialog.parmWorkflowComment(); try { Workflow::activateFromWorkflowType(workFlowType,recId,note,NoYes::No); this.callSubmitEventHandler(WorkflowType,recId); info("Submitted to workflow"); } ...

DSPHTMLCommentUtility d365fo x++

DSPHTMLCommentUtility  d365fo x++ Code: /// <summary> /// This is a framework class. Customizing this class may cause problems with future upgrades to the software. /// </summary> abstract class DSPHTMLCommentUtility { FormGroupControl commentHeaderGroupControl; Timezone userPreferredTimeZone; HcmIHTMLCommentDialog htmlCommentDialog; const str commentGroupControlName = 'commentGroupControl'; const str commentHTMLViewerControlName = 'commentHTMLViewerControl'; Map commentControlsMap; FormControlId selectedCommentControlId; /// <summary> /// The secondary instruction for the comment dialog. /// </summary> /// <returns>A string to use as the dialog's secondary instruction</returns> /// <remarks> /// Override this method if you want to provide a secondary instruction on the comment dialog. /// </remarks> public str getSecondaryInstruction() { retu...

DSPUtil d365fo x++

DSPUtil  d365fo x++ Code: class DSPUtil { private static DSPUtil utilObject; public static DSPUtil construct() { if(!utilObject) utilObject = new DSPUtil(); return utilObject; } public void openDocumentAttachmentForm(Object _caller, Common _record) { if (_record) { Args args = new Args(menuItemDisplayStr(DocuView)); args.caller(_caller); args.record(_record); args.menuItemName(menuitemDisplayStr(DocuView)); args.menuItemType(MenuItemType::Display); FormRun formRun = classfactory.formRunClass(args); formRun.init(); formRun.run(); formRun.wait(); } } public boolean isRoleAttachedWithCurrentUser(str _aotName) { boolean ret; SecurityRole role; SecurityUserRole userRole; ; select firstonly1 role exists join userRol...