How to close Work Orders on the Sales Order when SO is ...

文章推薦指數: 80 %
投票人數:10人

Every time the “Close Order” button clicked, the current Sales Order will be reloaded and become in “Closed” status. The Before Load User Event ... AECloudConsultantsNetSuiteBlog AECloudNetSuiteContentHelpBlog. HowtocloseWorkOrdersontheSalesOrderwhenSOisclosedusingSuiteScripts. Jul262017 PostedBy:aecc Comments ConfigurationFormsCustomizationsandConfigurationsIntegrationSuiteFlowSuiteScriptsUncategorised ThereisanativebuttononthesalesorderthatcanclosetheSO.Asshownbelow: IftheSalesOrderisclosed,theusercanfetchfieldvaluesfromtheSalesOrderbutcannotmakeanychangesontheSalesOrder. Insomecases,theuserwanttoalsoclosedtheWOonthelineitemsublistthatcreatedonthisSalesOrder. WecanuseaUserEventBeforeLoadscripttoachievethis.Sincetheclickon“CloseOrder”. ButtonwillnottriggerBeforeSubmitorAfterSubmitUserEventScript. Hereisthesolution: Everytimethe“CloseOrder”buttonclicked,thecurrentSalesOrderwillbereloadedandbecomein“Closed”status.TheBeforeLoadUserEventScriptwillcheckthisstatusandthe“IsWOClosed”field.Onlywhenthestatusequalto“Closed”and“IsWOClosed”isfalse,thescriptwillexecuteandfindallWorkOrdersontheitemsublistandclosethem.AfterThisactionfinished,the“IsWOClosed”willsettotrue. functionbeforeLoad_closeAllWO(type,form,request){ varstatus=nlapiGetFieldValue('status'); if(type=='view'&&status=='Closed'){ varlineCount=nlapiGetLineItemCount('item'); for(vari=1;i<=lineCount;i++){ varWOID=nlapiGetLineItemValue('item','woid',i); if(!isEmpty(WOID)){ varWO=nlapiLoadRecord('workorder',WOID); varWOStatus=WO.getFieldValue('status'); if(WOStatus!='Closed'){ WO.setFieldValue('orderstatus','B'); varWOLineCount=WO.getLineItemCount('item'); for(varj=1;j<=WOLineCount;j++){ WO.setLineItemValue('item','isclosed',j,'T'); } nlapiSubmitRecord(WO); } } } } } Afteruserclickstheclosebutton,therelatedWorkOrderwillalsobeclosed,asshownbelow TusharMohite Iwantedtosortworkordersbydays,statusandoperationsthorughscriptinganybetterideaonthis. Pleaseshare. Search Category Configuration3FormsCustomizationsandConfigurations5Integration7SuiteFlow1SuiteScripts14Uncategorised1 RecentPosts Howtocreate.zplextensionfiletoprintcustomShippingLabelsdirectlytoaZebraprinter Mar112021 HowtocreateabuttoninNetSuitetoopenasavedsearchresult Oct62017 HowtoPreventUserfromEditingtheRecord—UsingClientSideScript. Sep272017 IncludeCustomModuleinNetSuite2.0Script. Sep202017 Overcomesavedsearcheach()functionlimitation Sep132017 Archives March2021 October2017 September2017 July2017 April2017 Tags AccountingclientsidescriptconfigurationcustomizationsGeneralLedgerIntegrationJavascriptManufacturingNetSuiteRoutingSavedSearchesscriptingsubrecordsSuiteFlowSuiteScriptSuiteScript2.0



請為這篇文章評分?