Create request for quotation using x++ in D365FO

Request for quotation (RFQ) is issued by organization to receive competitive offers from various vendors. In this technical article, you will create request for quotation using X++ in D365FO.
Let’s start!
- Create a runnable class (job)
- Paste the code in the job shown below:
AxPurchRFQCaseTable axPurchRFQCaseTable;
AxPurchRFQCaseLine axPurchRFQCaseLine;
PurchRFQCaseTable purchRFQCaseTable;
PurchRFQCaseLine purchRFQCaseLine;
str RFQCaseId;
NumberSeq numberSeq;
numberSeq = NumberSeq::newGetNum(purchParameters::numRefPurchRFQCaseId());
numberSeq.used();
RFQCaseId = numberSeq.num();
axPurchRFQCaseTable = new AxPurchRFQCaseTable();
axPurchRFQCaseTable.parmRFQCaseId(RFQCaseId);
axPurchRFQCaseTable.parmBidType(PurchRFQBidType::Open);
axPurchRFQCaseTable.parmCurrencyCode('USD');
axPurchRFQCaseTable.save();
axPurchRFQCaseLine = new AxPurchRFQCaseLine();
axPurchRFQCaseLine.axPurchRFQCaseTable(axPurchRFQCaseTable);
axPurchRFQCaseLine.parmRFQCaseId(axPurchRFQCaseTable.parmRFQCaseId());
axPurchRFQCaseLine.axPurchRFQCaseTable(axPurchRFQCaseTable);
axPurchRFQCaseLine.parmLineItemType(PurchRFQLineItemType::Item);
axPurchRFQCaseLine.parmItemId('PRD000709'); //Replace ItemId as per your system's data
axPurchRFQCaseLine.parmItemName(InventTable::find('PRD000709').itemName()); //Replace ItemId as per your system's data
axPurchRFQCaseLine.parmPurchQty(10);
InventDim inventDim;
inventDim.InventLocationId = InventLocation::find('MW').InventLocationId; //Replace Warehouse as per your system's data
inventDim.InventSiteId = InventLocation::find('MS').InventSiteId; //Replace Site as per your system's data
inventDim = InventDim::findOrCreate(inventDim);
axPurchRFQCaseLine.parmInventDimId(inventDim.inventDimId);
//parmInventDimId('MIPL-000002');
axPurchRFQCaseLine.parmCurrencyCode('USD');
//axPurchRFQCaseLine.parmDefaultDimension(5637144576);
//Replace Default Dimension Rec Id as per your system's data
axPurchRFQCaseLine.save();
- Replace the data as per your company’s data
- Execute the job and see the newly created RFQ.
So, in this way you can create request for quotation using X++ in D365FO. Moreover, if this helps you, please Like, Comment and Share to help other people.
If you found any ambiguity or a better solution, please feel free to ask.
Website: Click here
Blog: Click here
YouTube: Click here
GitHub: Click here
Facebook: Click here
Don’t give up. Normally it is the last key on the ring which opens the door. – Paulo Coelho
Pingback:Create request for quotation using x++ in D365FO - Dynamics 365 Finance Community