Solved

Substitution Variables

  • 23 November 2021
  • 10 replies
  • 48 views

Userlevel 3
Badge +8

Started anbother thread as the previous one was marked as solved.

 

We have an issue whereby sometimes substitution variables work, and sometimes not.  The patterns and findings are as follows:

 

We have a notification setup to fire upon project.approval_status being updated. The fields that do not reliably work in the resulting notification messages are:

  • project.user_def1
  • project.user_def2
  • project.created_by

Here are my the findings from testing

  1. If you change the Approval Status on the Project by directly changing the field on the Project screen.  The Notification goes out correctly with all values.
  1. However, In our application, the Project Approval status is typlically changed via a business rule triggered from TASK.  The XML for this rule output looks like this

<update_project>
<project>
<project_id>@project_id</project_id>
<proj_status>OPEN</proj_status>
<approval_status>SUBMITTED</approval_status>
<update />
</project>
</update_project>

  1. This update is then captured via a second Business Rule that send out the Notification (the same rule that send out the notificaiton in step 1 above) However, now, the values User_def1,user_def2 a d created_by are left blank!
  2. If i run the output XML from the first rule in the XML Poster, i get this result

<update_project_result>
  <project>
    <project_id>154</project_id>
    <project_title>test</project_title>
    <person_id_owner>ADMIN</person_id_owner>
    <status>OP</status>
    <proj_status>OPEN</proj_status>
    <reopened>N</reopened>
    <place_id>ZZ PLACE ONE</place_id>
    <place_id_to_bill>ZZ PLACE ONE</place_id_to_bill>
    <approval_status>SUBMITTED</approval_status>
    <days_open>1</days_open>
    <address_id>3459</address_id>
    <currency>GBP</currency>
    <important>N</important>
    <corporate_currency>GBP</corporate_currency>
    <user_def_dttm1>2021-11-26T00:25:00.0000000</user_def_dttm1>
    <user_def_dttm2>2021-11-26T01:50:00.0000000</user_def_dttm2>
    <modified_by>ADMIN</modified_by>
    <modified_dttm>2021-11-23T11:22:22.4473891</modified_dttm>
  </project>
</update_project_result>

  1. NOTE here, the values that are then missing from the notification message are not shown in the XML result!  I think this may be the root of the issue.  
  2. So, the question at this stage is why are those fields not shown in the result above?  I have checked the Custom Meta data for the Project table and they are defined just like the user_def_dttm1 & 2 that are in the result.
icon

Best answer by MartinF 24 November 2021, 10:45

View original

10 replies

Userlevel 7
Badge +17

Hi @MartinF,

When you have linked Business Rules like this it often comes down to the point at which you have set the Business Rule execution point as i.e. before insert/after insert. Most likely cause is that, when the BR does the update it is triggering the notification message but not whatever is populating the user def fields due to their execution points differing.

I can understand why a user_def field would act this way as it would not be used in baseline an therefore must have some additional configuration set up that could be triggering in a different order. Not sure why created_by would not already be there on an update though…..

Is there a reason why this is an XML update rather than doing a table name column name value update for the project status field? XML business rules are far more likely to encounter these issues than the built in BR output methods as they are not standard outputs.

Hope this helps you narrow the issue down somewhat.

Kind regards,

Lee Pinchbeck

Userlevel 3
Badge +8

Hi @Lee Pinchbeck ,

 

Thanks for the reply.  The thing is, the Notification Message doesnt even pick up the previous values on the Project record, all the fields that are not populated are mandatory when creating a new Project.  I could understand your suggestion if the previous values were there instead, but we just get blanks.

 

As for your secioind point, ,i just copied other rules that were originally setup by someone other than me, but i will look into doing it how you suggest.

 

regards,

Martin

Userlevel 7
Badge +17

Hi @MartinF,

Sounds almost as if the notification BR is not looking at the actual project record but instead taking direct from the update transaction itself.

Are you able to post the notification message setup to see if that all looks correct?

Kind regards,

Lee Pinchbeck

Userlevel 3
Badge +8

Hi @Lee Pinchbeck ,

Yes, see attached screenshots for the setup. Not sure how i would attach it too the output as you suggest, but i agree thats how it appears.  I suspected it maybe how some BR internals work withing the system to save round trips to the server?

 

See attachments for the setup

 

regards,

Martin

Userlevel 3
Badge +8

@Lee Pinchbeck 

Correct attachmwents added now

Userlevel 7
Badge +17

what is the execution point on the notification BR?

Userlevel 3
Badge +8

@Lee Pinchbeck

 

After Commit Insert or Update

Userlevel 3
Badge +8

Hi @Lee Pinchbeck 

 

Im just looking into your comments in regard to XML outputs in BR:- “Is there a reason why this is an XML update rather than doing a table name column name value update for the project status field? XML business rules are far more likely to encounter these issues than the built in BR output methods as they are not standard outputs.”

 

So the only other option i see is to create a custom process of type ‘Value - Create a process thats sets a value on a record’, however the only exececution pioints it gives me are Before change/update etc and explicit call.  However we want it to execute aftee the update of another record (Task), so i dont see how that would apply?

Userlevel 7
Badge +17

Hi @MartinF,

I would try moving the execution point forward to before change/update and see if that makes a difference. To my understanding the execution point is where the BR will add its changes to the triggering transaction rather than the instance at which it will look to trigger. So it will see the change coming in and before committing that to the database it will add its own change if that applies. It may be why the notification message is missing the changes as they are being added after commit when the notification message has already triggered.

It is worth giving it a go to see if it succeeds.

Kind regards,

Lee Pinchbeck

Userlevel 3
Badge +8

Hi @Lee Pinchbeck

 

We have fixed this, the missing fields needed setting as ‘Force Select’ =true in the custom Metadata, they now appear in the XML results and the Notification now has a full compliment of values.

 

Regards,

Martin

Reply