My method: query for the record I needed in the child buscomp, obtain the row id, and then use that row id to update the primary id field of the parent. For example, if I needed to set the primary position on the Account buscomp, I would begin by looking up the position id, then I would use a SetFieldValue statement to set the Primary Position Id with the id I had retrieved.
Wrong approach! That is the dangerous way. A scripting error will potentially corrupt your database in the same way direct sql could, by breaking its referential integrity. Directly setting a primary id field is not supported by Oracle.
The feature I didn't understand, which makes the process much easier and safer, is a system field called SSA Primary. You may have noticed this field in MVG Applet configurations. It's a system field, much like Created or Id, but it is different in two important ways:
- The SSA Primary field does not correspond directly to a database column.
- The SSA Primary field is editable.
Like other system fields, it is not listed in the Fields object in Tools, and you don't have to explicitly activate it in scripting.
Using the SSA Primary field, here is the correct way to use script to set the primary on an MVG, as recommended by Oracle:
- Get the MVG business component using the BusComp.GetMVGBusComp method.
- Use BusComp.SetSearchSpec and BusComp.ExecuteQuery methods to locate the correct record on the MVG business component.
- Set the SSA Primary field with the statement BusComp.SetFieldValue("SSA Primary Field", "Y"), substituting the actual business component variable name.
- Use BusComp.WriteRecord on the parent business component. This is because the Primary Id field is on the parent.
Some versions of Siebel Tools will give a semantic warning when you check the syntax after you try to set the SSA Primary field. This is a Siebel bug, and this warning can be safely ignored.
Update - Fixed a typo caught by commenter Duarte: Above instructions previously contained BusComp.SetFieldValue("SSA Primary", "Y") instead of BusComp.SetFieldValue("SSA Primary Field", "Y"). Thanks Duarte!
9 comments:
You have to query the MVG buscomp to locate the record you want to be primary. Otherwise, you could loop through them with NextRecord. You wouldn't be setting the primary randomly, so you need to somehow query the MVG buscomp.
Once you have the correct record in the MVG buscomp, you need to use SetFieldValue to update the SSA Primary field on the selected record in the MVG buscomp.
The only operation you need to do on the parent buscomp is WriteRecord.
Hi,
Actually is
BusComp.SetFieldValue("SSA Primary Field", "Y"), instead of
BusComp.SetFieldValue("SSA Primary", "Y")
rgds
Duarte
Thanks, Duarte. I've updated the post.
hai
this is good approch
you can set seachspec then it returns records in IF(FirstRecord()) returns true value ..
then you will select as SSA primary ID field. but search spec is based on Primary key
..
I think you have to apply searchspec then srotspec then you can change the order of the returning records so it will give you appropriate records then using PICK() method ..
you get this value..
any issues on this comment plese reply me visnu1512@gmail.com ..
SO that I can learn on this things ..\
Hi Vishnu,
I believe you are thinking of a picklist, and not an multi-value group. Theoretically, it would be possible to create a picklist using the MVG business component as the pick business component, and use a pick map to set the MVG primary. However, if you are setting the primary through script and if there are no other factors involved, this extra configuration doesn't make sense to me.
Thanks,
Jim
I think I have never seen such blogs ever before that has complete things with all details which I want. So kindly update this ever for us.
social media marketing westchester New York
Have you tried twitterfeed on your blog, i think it would be cool.:**-; Process audits
An example from Oracle Support
var bcMvg;
var boAccount = TheApplication().GetBusObject("Account");
var bcAccount = boAccount.GetBusComp("Account");
bcAccount.SetViewMode(AllView);
bcAccount.InvokeMethod("SetAdminMode","TRUE");
bcAccount.ClearToQuery();
bcAccount.ActivateField("Id");
bcAccount.SetSearchSpec("Id", "1-5H9");
bcAccount.ExecuteQuery(ForwardOnly);
if (bcAccount.FirstRecord())
{
bcMvg = bcAccount.GetMVGBusComp("Sales Rep");
bcMvg.SetSearchSpec("Id", "0-57T1J");
bcMvg.ExecuteQuery(ForwardBackward);
if (bcMvg.FirstRecord())
{
bcMvg.SetFieldValue("SSA Primary Field","Y");
bcMvg.WriteRecord();
}
}
Post a Comment