Search code examples
salesforceapex

Salesforce REST API Create an order class with Wrapper Not working


anyone can solve this issue as im getting Error - Method does not exist or incorrect signature: void productMAp(String) from the type CreateOrders

        Order ord = new Order(
        AccountId = oderWrap.AccountId,
        
        EffectiveDate = EffectiveDate,
        Status = oderWrap.Status,
        PriceBook2Id = PricebookList[0].id,
        contractid = contractMap.get(oderWrap.AccountId).id,
        ShippingStreet = contractMap.get(oderWrap.AccountId).Account.ShippingStreet,
        ShippingCity  = contractMap.get(oderWrap.AccountId).Account.ShippingCity,
        ShippingpostalCode = contractMap.get(oderWrap.AccountId).Account.ShippingpostalCode,
        ShippingCountry = contractMap.get(oderWrap.AccountId).Account.ShippingCountry,
        ShippingState = contractMap.get(oderWrap.AccountId).Account.ShippingState
    );
    for(OrderWrapper.OrderLineItems oderLineItem  : oderWrap.OrderLineItems){
        product2 pro = productMAp(oderLineItem.LineItemCode);
        PricebookEntry pbe = PricebookEntryMAp(pro.id);
        OrderItemList.add(createOrderLineItimes(ord,integer.valueof(oderLineItem.Quantity),pro,pbe));
    }
    if(ord!=null){
        insert ord ;
        for(OrderItem poLine : OrderItemList) {
            poLine.orderid =poLine.order.Id;
        }
        insert OrderItemList;
    }

Solution

  • Hard to say, what's the type of "productMap"?

    Did you mean to use productMap.get(oderLineItem.LineItemCode)?