Monday 11 May 2020

MVG in Siebel : Association and Disassociation

Hello All,

This post is in continuation of my previous post http://www.siebelfoundations.com/2020/05/record-association-and-disassociation.html , Association and Disassociation in MVG applet.

So if the case arise wherein we have to write script of parent BC not the MVG BC. i.e. a case where Order is parent and Voucher is MVG BC, we have to write script on Order.

For Association of Records

The Steps are very simple.

1. Instantiate the Current BC (Order in this case)
2. Get MVG Bus comp from the field on which MVG is based
3. Get Assoc Bus comp from the MVG Bus Comp
4. Specify the search on the Assoc Bus comp
5. Trigger Associate Event


//Add Record in MVG -- Initiate BC - Get MVG BC from Field - Get Assoc BC - Fire Search Spec and Associate

var oNumber = "1-12345TXN";
var oBusObject = TheApplication().ActiveBusObject();
var oBusComp = oBusObject.GetBusComp("Order Entry - Orders");
with(oBusComp)
{
ActivateField("Voucher Number");
SetViewMode(AllView);
ClearToQuery();
SetSearchSpec("Order Number",oNumber);
ExecuteQuery(ForwardBackward);
if(FirstRecord())
{
var oMVGBuscomp = GetMVGBusComp("Voucher Number");
var oAssocBusComp = oMVGBuscomp.GetAssocBusComp();
with(oAssocBusComp)
{
ActivateField("Order Number");
ActivateField("Voucher Expiry Date");
ClearToQuery();
var expr = "[Order Number] = '"+oNumber+"' AND [Voucher Expiry Date] >= Today()";
SetSearchExpr(expr);
ExecuteQuery(ForwardBackward);
var isRec = FirstRecord();
while(isRec != "")
{
Associate(NewBefore);
isRec = NextRecord();
}
}
}
}

In case of deleting record from MVG 

The Steps are very simple.

1. Instantiate the Current BC (Order in this case)
2. Get MVG Bus comp from the field on which MVG is based
3. Specify the search and till no records left
5. Delete record


////Delete from MVG -- Initiate BC - Get MVG BC from Field  - Delete Record from MVG
var oNumber = "1-12345TXN";
var oBusObject = TheApplication().ActiveBusObject();
var oBusComp = oBusObject.GetBusComp("Order Entry - Orders");
with(oBusComp)
{
ActivateField("Voucher Number");
SetViewMode(AllView);
ClearToQuery();
SetSearchSpec("Order Number",oNumber);
ExecuteQuery(ForwardBackward);
if(FirstRecord())
{
var oMVGBuscomp = GetMVGBusComp("Voucher Number");
with(oMVGBuscomp)
{
ClearToQuery();
ExecuteQuery(ForwardBackward);
var rec = FirstRecord();
while (rec)
{
DeleteRecord();
rec = FirstRecord();
}
}
}
}

Here in this case we delete record from MVG Bus comp instance.

No comments:

Post a Comment

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...