on ‎2021 Apr 12 2:32 PM



Hi,
we are solving an issue, where we have created an Custom Business Rule in SAP Field Service Management. This Business rule should fire only when there are records in the checklist field of type table. Our problem is that we are unable to set an condition based on the SELECT(located in the Variables section of the Business rule). Because the .length function always returns 0, when we create a ServiceCall. But the Business rule works, when we use the "Execute" of the Business rule on the very same ServiceCall. So we suspect that the problem lies somewhere in the order of the action, where the SELECT is faster than the Record create, and therefore the .length function returns an information, about empty array.
The mentioned SELECT statement:
select z.serialNumber, z.udf.z_f_eq_absguid, e2.value FROM ChecklistInstance c JOIN ChecklistInstanceElement e ON c.id = e.checklistInstance JOIN ChecklistInstanceElement e2 ON e.parent = e2.parent JOIN Equipment z ON e.object.objectId = z.id WHERE e.elementId = 'z_f_sf_menilzaritem' AND e2.elementId = 'z_f_sf_menilzarsc' AND e.value IS NOT NULL AND e.value != '' AND e2.value IS NOT NULL AND e2.value != '' AND c.object.objectId = ${new.object.objectId}
Can anyone confirm, if that's the case, where we can find more information about the order of the actions or some kind of workaround?
Thank you.
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Hi Tomas,
I see you defined this rule with Execution = Synchronous in its trigger.
This indeed means the rule is executed before the db-updates (or -creations) of the related triggering application happen. Usually you use synchronous rules as validation rules, to return an error to the application in case any of its constraint values evaluate to false. This means synchronous rules are intended to prevent updates in such a case and therefore they have to be executed before the updates happen.
So I think it should help to get your rule fired, if you set Execution = Asynchronous.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you! It looks like it works now, will test further tomorrow. We have probably set the delay too short at first, so it was inconsistent through our testing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 7 | |
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.