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)
        ActivateField("Account Id");
        SetSearchSpec ("Account Id", AccountId);
ParentBC = null;
BC = null;
BO = null;


  1. In which view is this , Jim ? I think the only place is to use the applet searchspec of the Association applet.

    The Opportunity type will have to be passed to the searchspec via..a profile attribute (I hate profile attributes). I am guessing using the ChangeRecord event of the Opportunity BC, use the SetProfile action to set the Opportunity Type into a profile attribute.

    Then one can give an IIF condition in the Association applet's searchspec to apply the searchpec conditionally.

  2. i guess we can use search spec in the associate applet by getting accound id in profile attribute

  3. You guys are very close. think for the minimum amount of change required to achieve this.

  4. Are you referring to using a link searchspec ? Using ParentFieldValue there ?

  5. I tried setting search spec with parent field value, but applet stopped opening up after that, any other ideas?

  6. Create two separated applets (filtered one on internal and one on external); after that put in join on bc of the assoc applet the filter(internal or external) and after that create two filtered assoc applet associated respectively to the internal and external. It should do the job with the price of duplicated objetcs

  7. Jim, are you referring to "Parent BC Constraint Field" user property ? For some Product Associate applets ?

  8. Thanks guys for your comments, sorry I couldn't try these options out, personally I like the toggle applet solution but as I am very busy with my current assignment at the moment I couldn't try it out.

  9. Jim,
    Have you tried constraining the data using the Source Field which is one of the MVL property.