Hi All,
I want to add new project programmatically and is following this tutorial https://my.sage.co.uk/Sage200SDKDocs/html/DOC0354_Example.html#NEWPROJECT
Below are my code:
private PCProjectAdjustmentItem CreateCostAdjustmentItem(PCProjectCostAdjustment coordinator, string projectCode, string costItem, string narrative, string accountReference, string costCentre, string Department, decimal goodsValue, DateTime transactionDate) { PCProjectAdjustmentItem item = (PCProjectAdjustmentItem)coordinator.ProjectAdjustmentItems.AddNew(); try { item.Project = PCProjectFactory.Factory.Fetch(projectCode); PCCostRevenueSummaryViews views = PCCostRevenueSummaryViews.CreateNew( CostRevenueAnalysisEnum.Cost, ProjectEnquiryGroupingEnum.ProjectCostItem); views.Query.Filters.Add(new Sage.ObjectStore.Filter(PCCostRevenueSummaryView.FIELD_PARENTPROJECTITEMCODE, projectCode)); views.Query.Filters.Add(new Sage.ObjectStore.Filter(PCCostRevenueSummaryView.FIELD_PROJECTITEMCODE, costItem)); views.Find(); PCCostRevenueSummaryView view = views.First; item.ProjectCostItem = PCProjectCostItemFactory.Factory.Fetch(view.PCProjectItemID); item.Narrative = narrative; item.TransactionDate = transactionDate; Sage.Accounting.Common.NominalSpecification accountNominalSpecification = Sage.Accounting.Common.NominalSpecificationFactory.Factory.CreateNew(accountReference, costCentre, Department); item.NominalSpecification = accountNominalSpecification; item.GoodsValue = goodsValue; }catch(Exception ex) { Logger.WriteLog("Error in CreateCostAdjustmentItem goods value["+ goodsValue + "] - "+ex.ToString()+";"); throw ex; } return item; }
However, I get this error:
Sage.Accounting.Exceptions.Ex40105Exception: You must specify a posting type nominal code. at Sage.Common.DataAccess.BusinessObject.OnValidated(ValidatedEventArgs e) at Sage.Common.Rules.ErrorPropertyRuleAction.DefaultInvalidRuleAction() at Sage.Common.Rules.RuleAction.PerformAssociatedAction(ValidRuleAction validRuleAction, InvalidRuleAction invalidRuleAction) at Sage.Accounting.ProjectCosting.PCProjectAdjustmentItem.ValidateNominalSpecification(NominalSpecification nominalSpecification, RuleActionType ruleActionType, String fieldName) at Sage.Accounting.ProjectCosting.PCProjectAdjustmentItem.set_NominalSpecification(NominalSpecification value) at GLProjectAccrual.Forms.ImportCostRevAdjTemplateForm.CreateCostAdjustmentItem(PCProjectCostAdjustment coordinator, String projectCode, String costItem, String narrative, String accountReference, String costCentre, String Department, Decimal goodsValue, DateTime transactionDate);
But I did not found any variable related to posting type nominal code. What are the value to set and to set it which variable? Thank you.