This post more of an open question then an answer to problem. I came across this requirement few days ago and pondered for few hours to find an optimal solution. In the end I had to revert to scripting in the final solution.
But I still believe there is a better way to do this. Therefore I am putting this in front of you all so that somebody out there can provide an answer that I am looking for
Requirement:
We have a Service Request as Parent BC and Activities as Child BC.
When a Flag called ‘Approved’ is checked on Activities List Applet then value of a Field called ‘Change Description’ on Service Request should be set as ‘Activity Approved’
Solution I tried:
- Create a new Flag Field (base field) in Service Request.
- Create a user Property ‘On Field Update Set’ on Service request with following value:
“Flag Field”, “Change Description”, “Activity Approved” - In the Activities write the following script in BC Write Record Event.
if (Approved == "Y")
{
this.ParentBusComp().SetFieldValue("Flag Field","Y");
}
Problem:
I don’t like this scripting and this base field in Service Request. I tried with a calculated and Multi Value Field but these fields don’t work with ‘On Field Update Set’ User Property on BC
But I am sure that there has to be a better way to do it. Please if you know there is a better way, then please let us all know.


(3 votes, average: 4.00 out of 5)




Even if it is not much script code, I would prefer workflow.
The BO for the workflow would be Service Request. You can do all necessary checks, lookups and updates across the entire BO.
A runtime event on the Action BC (like SetFieldValue) could trigger the WF.
Try the following
One option could be as below
On Action BC
1) Set the Immediate Post Change property on the ‘Approved’ field.
On Service Request
1) Check if there is an existing MVL to activity, If not create it
2) Create a MVF using this MVL and name the field as ‘Activity Approved Flag’. The destination field would be ‘Approved’ on Action BC
3) Create a Calc field ‘Activity Approved Flag’
Value: IIF(EXISTS([Activity Approved Flag] = ‘Y’), “Activity Approved”, “”)
4) Use this field to set the value of ‘Change Description’ in On Field Update Set BC User Property
Note: If the relation between SR and Activity is 1:1, you can think of using a Join field instead of MVL/MVF
Regards
The only problem I see with this record is
On Field Update Set BC User Property doesn’t work with MVL and calculated fields
so the last part of the solution you mentioned is not going to work.
The scripting method is dangerous because the parent buscomp is not always known. Can you guarantee that Approved will only by “Y” in cases where the Activity has a valid SR as a parent?
I agree that workflow might be a better approach, and would prefer to use runtime events (unless you need this logic to work in both the Activities screen and the Service Requests screen).
try to use On field update invoke user property in Activity BC to call method in service request and use ‘Named Method’, ‘SET’, ‘[Value]‘ user property in Service Request BC.
@Neel
My suggestion is to user On field Update Set on Service Request BC to update ‘Change Description” field based on calc field value from Action BC
On Action BC
1) Set the Immediate Post Change property on the ‘Approved’ field.
On Service Request
1) Create a MVF using ‘Action’ MVL with details as below
Field Name: Activity Approved Flag
Multivalued: Y
MVL Name: Action
Dest Field: Approved
Force Active: Y
3) Create a Calc field ‘Activity Approved Flag Calc’
Value: IIF(EXISTS([Activity Approved Flag] = ‘Y’), ‘Y’, ‘N’), try making it ‘Force Active’ for testing it. Expose this on the SR Form applet to check the value.
4) Use this field to set the value of ‘Change Description’ as mentioned below
Create a user Property ‘On Field Update Set’ on Service request with following value:
“Activity Approved Flag Calc”, “Change Description”, ”
”
Note: I’ve exposed all fields used in this requirement on SR form applet for testing. You can experiment by ‘Force Active’ting all affected fields and turn them off if not required
contact me @ reach_hari@yahoo.com if this doesn’t work.
hey why to make things so complex?
Simple approach… [Correct me if am wromg]
Set the Immediate post changes of “Approved Flag” to TRUE in Activitiy BC.
Create 1 Field “Activity Approval” in Service Request BC by having a join to “Approved Flag” [Activity BC]and set Immediate Post Chanes to TRUE. On “Change Description” [Assumed to be Calculated Field] Field in Service Request BC, set the calculated value as IIf ([Activity Approval] = “Y”,”Activity Approved”,”Activity not Approved”).
Joins would be used in M:1 relation. But here Service Request and Action have 1:M relation.
Try this out ->
On Action BC create this User Property -
On Field Update Invoke 1 : “Approved”,”Service Request”,”Update Status”,”[Approved]=”Y”"
Now create a User Property on Service Request -
Named Method 1 : “UpdateStatus”,”SET”,”Change Description”,”Activity Approved”