Create service order In D365 using X++
static void serviceOrder(Args _args)
{
SMAServiceOrderTable sMAServiceOrdertable,serviceOrderTable;
SMAServiceOrderLine sMAServiceOrderline;
NumberSeq NumberSeq;
ttsBegin;
NumberSeq = NumberSeq::newGetNum(SMAParameters::numRefServiceOrderId(),true);
serviceOrderTable.ServiceOrderId = NumberSeq.num();
serviceOrderTable.CustAccount = 'US-002';
serviceOrderTable.ProjId = '000058';
//display Customer Name as Service Order Description
serviceOrderTable.Description = CustTable::find('US-002').name();
//insert Service Address
serviceOrderTable.updateCustAddress();
serviceOrderTable.StageId = 'Planning';
serviceOrderTable.insert();
sMAServiceOrderline.ServiceOrderId = serviceOrderTable.ServiceOrderId;
sMAServiceOrderline.initFromServiceOrder(serviceOrderTable.ServiceOrderId);
sMAServiceOrderline.ProjCategoryId="Car Audio";
sMAServiceOrderline.ServiceObjectRelationId="000021";
sMAServiceOrderline.ServiceObjectId="000002";
sMAServiceOrderline.ServiceTaskId="Inspector";
sMAServiceOrderline.insert();
info("work finished");
ttsCommit;
}
Keep Daxing!!
No comments:
Post a Comment