on 07-13-2017 11:31 AM
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
Shopping Cart BO is called "InternalRequest". You should be able to find this in the Repository Explorer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think this actually came to anything, but Asif's answer was useful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.