Delete Record from MVG
I need to remove some records from M:M MVG. Scenario is like that if there is any record available in the MVG having Primary as 'Y', i need to add one new record here ,need to set the primary of this new record as true,and then delete the old record.The code which i used is as follows:
var OrgMVG = bcServiceAgreement.GetMVGBusComp("Account");
var oAssocMVGBC = OrgMVG.GetAssocBusComp();
with(oAssocMVGBC)
{
ActivateField("SSA Primary Field");
SetViewMode(AllView);
ClearToQuery();
SetSearchSpec("Id", newAccountOrg);
ExecuteQuery(ForwardOnly);
var isExist = oAssocMVGBC.FirstRecord();
if (isExist)
{
oAssocMVGBC.Associate(NewAfter);
}
ClearToQuery();
SetSearchSpec("Id", newAccountOrg);
ExecuteQuery(ForwardOnly);
var isExist1 = oAssocMVGBC.FirstRecord();