Showing posts with label Scriptless Challenge. Show all posts
Showing posts with label Scriptless Challenge. Show all posts

June 17, 2016

Scriptless Challenge : How to constrain association list applet dynamically?

Association applet let's you associate records from an existing list of records. Unlike pick applets these association list applets doesn't have any out of the box way of constraining records.

Consider scenario: When opportunity type is internal, system should only show internal marketed products for opportunity in product association list applet and for opportunity type external system should show only external marketed products. Products are marked as internal and external by product type field.

Challenge: According to oracle there is no other way then scripting on web load of association applet to filter the records. Script can look something like following. And it works flawlessly.

Can you suggest any script less alternative?

function WebApplet_Load ()
{
var BO;
var ParentBC;
var BC;
var AccountId;
BO = TheApplication().ActiveBusObject();
ParentBC = BO.GetBusComp("Opportunity");
if(ParentBC.Name = "Opportunity")
{
    AccountId = ParentBC.GetFieldValue ("Account Id");
    BC = this.BusComp();
    with (BC)
    {
        ClearToQuery();
        ActivateField("Account Id");
        SetSearchSpec ("Account Id", AccountId);
        ExecuteQuery();
    }
}
ParentBC = null;
BC = null;
BO = null;
}