cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Shopping Cart Details From Purchase Order

former_member183363
Active Contributor
0 Kudos

Hi,

A customer wants to set the buyer responsible of a PO to the original requester . To do this I figure I need to go and find the shopping cart reference in the business transaction document references, get the ID, and retrieve the shopping cart to get the details.

There is a shopping cart document reference in the BTDRs, but there's no shopping cart BO in the repository explorer --- I did fuzzy searches for *Shop* and *Cart*, neither of which yielded results. I also made a key variable and assigned the ID and type from the PO's shopping cart reference, but a retrieve() call on the BusinessTransactionDocumentSearch BO yielded nothing, and a query just using type code 62 (Shopping Cart) as a parameter also yielded no results.

Does anyone have any ideas?

My code:

/*
Business Object: PurchaseOrder
Node: Root
Event: AfterModify
*/

import ABSL;
import AP.FO.BusinessDocumentFlow.Global;
import AP.Common.Global as common;

var prRefs = this.BusinessTransactionDocumentReference.PurchaseRequest;
if (prRefs.Count() == 1)
{
    var pr = prRefs.GetFirst();
    var creator = pr.CreationIdentity.FormattedName;
    var x = 10;
}

var key:common:BusinessTransactionDocumentKey;

var shoppingCartReferences = this.BusinessTransactionDocumentReference.Where(n => n.BusinessTransactionDocumentReference.TypeCode == "62"); //62 == Shopping Cart.
if (shoppingCartReferences.Count() == 1) //Should only ever be 0 or 1.
{
    var shoppingCartReference = shoppingCartReferences.GetFirst().BusinessTransactionDocumentReference;
    key.BusinessTransactionDocumentID.content = shoppingCartReference.ID.content.RemoveLeadingZeros();
    key.BusinessTransactionDocumentTypeCode = shoppingCartReference.TypeCode;
    var shoppingCart = BusinessTransactionDocumentSearch.Retrieve(key);
    if (shoppingCart.IsSet())
    {
        var requester = shoppingCart.MainBusinessTransactionDocumentPartyFormattedName;
        var x = 10;
    }
}

Thanks,

Lewis

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Shopping Cart BO is called "InternalRequest". You should be able to find this in the Repository Explorer.

Answers (1)

Answers (1)

former_member183363
Active Contributor
0 Kudos

I don't think this actually came to anything, but Asif's answer was useful.