cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Add item product in Customer Quote using ABSL.

pablo_daniel
Participant
4,065

Hi experts, i found a problem trying to add a product using ABSL Code.

Basically, i was created a Script that calls a WS (this WS returs a List of products with the ID Product, Quantity and Measure) and when a try to add a product i have a message Exception.

1) Using this way, inside the script in the CustomerQuote Extension BO , the products was added but i have a message exception (The product doesnt exist )

var itemToCreate = this.Item.Create(); //In this line, the exception is raised 😞 itemToCreate.ItemProduct.ProductKey.ProductID.content = material.InternalID.content; itemToCreate.ItemProduct.QuantityMeasureUnitCode = itemResp.GUabsmg; itemToCreate.FirstRequestedItemScheduleLine.Quantity.content = itemResp.zRtCmp ;

2) I tried another way to add a product but i cannot see the node/association ItemProduct.

var itemToCreate : elementsof CustomerQuote.Item;

//In the following lines i have an error because i cannot to access to the association ItemProduct.

itemToCreate.ItemProduct.ProductKey.ProductID.content = material.InternalID.content; itemToCreate.ItemProduct.QuantityMeasureUnitCode = itemResp.GUabsmg; itemToCreate.FirstRequestedItemScheduleLine.Quantity.content = itemResp.zRtCmp ;

There is another way to add the products??

Thanks!!!

View Entire Topic
PranavBhardwaj
Explorer

HI Pablo,

In one my similar requirements ,I first created the item with all the mandatory fields and then created product:

Please see the below code. Please let me know if you can create an item with the below approach.

varcreateitem = this.Item.Create();

createitem.Description.content = "Consulting Service";

createitem.ExpectedNetAmount.content = weightedvalue;

createitem.ExpectedNetAmount.currencyCode = "USD";

createitem.Quantity.content = 1;

createitem.Quantity.unitCode = "EA";

if (createitem.ItemProduct.IsSet()){

createitem.ItemProduct.ProductKey.ProductID.content = "10000000";

createitem.ItemProduct.ProductCategoryHierarchyProductCategoryIDKey.ProductCategoryInternalID = "1";

pablo_daniel
Participant
0 Kudos

Hi Pranav, thanks for the helping.

I tried several times with this way. My problem is with the line,

var createitem = this.Item.Create(); // In debug mode this line raise the message error "The item doesn´t have a product"

Even when the message is raised, the product is created and saved. But the message error still appearing :(.