Friday, August 19, 2011

How to update Child BC records on update of Parent BC record?

Siebel provides various ways of achieving the same solution, but you need to do the analysis beforehand to pick the right one. Recently I got one basic requirement that:

As soon as the Opportunity Sales Stage gets "Approved", all the Activities (Child of Opportunity) status should automatically set to "Approved".
Any Siebel Geek can offer multiple ways to achieve this solution:
1. Write a small script on "WriteRecord" event of the Opportunity business component.

2. People against scripting will not like Point#1 above and they might suggest to create a Workflow process with an Update operation on Action business component. And call this Workflow process in WriteRecord event of Opportunity or by Runtime event or by Workflow Policy.

3. Trigger a Workflow Policy when Opportunity Sales Stage = "Approved" which will call a WF Policy action with a program of type DB Operation.

I found another way of achieving the same solution (scriptless) and want to share with you. Using Data Validation Manager (DVM), you can achieve this as well. If you know how to update a field (SetFieldValue) using DVM, you might know what I am talking about.

Solution Details: 1. Navigate to Administration - Data Validation -> Rule Sets view.
2. Create a new record with the following data:

Name : Set Activity Approved
Business Component : Opportunity
Business Object : Opportunity

3. Drilldown on Rule Set Name.
4. Create new record under Rules view.

Sequence# : 1
Name : Set Status to Approve
Expression : [Status]="Approved"
Business Component : Action
Apply To : All Records
Return Code : Select any return code from the pick applet

5. Navigate to "Action" sub-view under the "Rules" view.
6. Create new record in Action applet:

Sequence# : 1
Type : Business Component
Business Component : Action
7. Create new record in "Field Values" applet
Field : Status
Value : Approved

8. Navigate to Administration - Data Validation -> Rule Sets view again and Activate the Rule set you just created.

9. Status changes to "Active".
10. Navigate to Administration - Runtime Events -> Action Sets view.
11. Create a new record:


Name : Activity Approved
Active : True
12. Create new action record:

Name : Call DVM
Action Type : BusService
Sequence : 1
Active : True
Business Service Name : Data Validation Manager
Business Service Method : Validate
Business Service Contect : "Rule Set Name", "Set Activity Approved", "Enable Log", "Y"
13. Navigate to Administration - Runtime Events -> Events view.
14. Create new record:

Sequence : -1
Object Type : BusComp
Object Name : Opportunity
Event : WriteRecord
Conditional Expression : [Sales Stage]="Approved"
Action Set Name : Activity Approved

15. Reload the runtime events.

You are done.

Now this is the time to test the solution:
1. Navigate to Opportunity -> Activities View.
2. Change the Sales Stage to "Approved".

3. See the change in activities status.

18 comments:

  1. One of the important thing that you might want to note here is the solution doesn't require SRF change.

    ReplyDelete
  2. Hi Gaurav,

    Thanks for posting this info, I have few queries...
    Firstly, While creating DVM rules we have to pick the BO and BC from the available picklist. Is This functionality available for all the custom BOs and BCs, or it is somewhat class based functionality?
    Secondly, In the 4th step of the above scenario you have mentioned an expression fro Action BC while creating a rule set. What is the significance of this expression there?

    ReplyDelete
  3. Hi Anonymous,

    1. This functionality is applicable for all BCs.
    2. The expression in the rule will identify the record set where Status is not = Approved. Please note that in DVM you have to define the negative condition, so all the activity records having Status = Approved, will be excluded.

    Cheers
    Gaurav

    ReplyDelete
  4. Never thought of this one. Very cool. Thanks!

    ReplyDelete
  5. Hello Gaurav,

    Thanks for this nice post...

    like this am facing one requirement.. can you please help me ?

    whenever the service request is created then need to create an activity..for this you have any solution using eScripting and DVM ?

    Thanks in advance
    Ramesh

    ReplyDelete
  6. Hi Ramesh, for your requirement you can write the code on WriteRecord event of Service Request BC.

    --Gaurav

    ReplyDelete
  7. Hi Gaurav,

    I Tried this on my local environment..
    but it is not working, may be it works on only thin client?

    Please correct me!!

    Thanks in advance
    Ram

    ReplyDelete
  8. Hi Gaurav,

    I have to reflect changes done on Parent BC field(Date)to one Child BC field .. how it is possible

    ReplyDelete
  9. Hi Gaurav,

    Thanks for solution. I tried doing the same step by step, but for me, only one activity status is getting change. Also, if I select the "Immediate Display" check box below return code, it pops up a message and no activity records status gets changed.
    What is the significance of this check box "Immediate Display".

    Thanks,
    AK

    ReplyDelete
  10. Hi AK,

    Please check if you have the "Apply To" set to "All Records". Checking the "Immediate Display" field would popup the message specified in "Message" field, but here requirement is not to display the message but to update the records, so you have to keep it unchecked.

    --GG

    ReplyDelete
  11. Hi Gaurav,

    In step 7, the value field you set is Approved. How do you/Siebel deal with this value in a multi-language environment?

    Thanks.

    ReplyDelete
    Replies
    1. Hi Anonymous,

      for multilingual environment you can use LookupValue() function to deal with it.

      --GG

      Delete
    2. Sorry , you cant use any Functions in Value of Action Applet. Its only Constant. So Look wont work

      Delete
    3. Yes , Value column in the action applet is constant. You cannot use any function or expression in that.Actually that limits the functionality of DVM.

      Jeevan

      Delete
  12. this cannot be done for all records in Applet without parent condtion ...just want to set the value fpr all records in this case ..above functionality can be modified?

    ReplyDelete
  13. Hi Gaurav,

    I tried the above step by step but still changes are not reflected. Here we need to add some condition based on that status will change?
    Please guide me what to do now.

    ReplyDelete
  14. Hi Gaurav,

    This is not working for me .This works only first child record of the parent not all child record
    So can you please help me

    Kind Regards
    Shallet

    ReplyDelete