Script include doesn't work when called by email script

MarkWendilJhonD
Tera Expert

Hi,

 

I created an email script to populate the email body of a notification. The notification is in the Catalog task [sc_task] table and it will require data from the Requested item [sc_req_item] table for its content. For some reason, dot-walking the fields using the request_item reference field on the Catalog task table doesn't seem to work (must be a known issue based on this KB article - Email scripts doesn't populate the dot walking field values in outbound emails - Support and Trouble...) .

 

With this, I have decided to use a script include instead and return an object containing all the fields needed for my notification. Please see my scripts below:

Email script: 

MarkWendilJhonD_0-1727855875201.png

 

Script Include:

MarkWendilJhonD_1-1727855936105.png

 

I checked my script include with a background-script using a static sys_id and it works just fine. But when I call this script include method from my email script, it doesn't work. It will execute the "else" statement even though the sys_id passed is correct (I logged the ritmID to check its value and it is the correct sys_id). 

 

I am not sure what other actions I can do after this. Please advise.

 

1 ACCEPTED SOLUTION

MarkWendilJhonD
Tera Expert

As per thorough investigation, there is a query business rule on the Requested item table and the 'system' user does not meet the condition to query the Requested item table. To fix this, I only added a gs.interactive condition in the BR script.

View solution in original post

2 REPLIES 2

Mr_X
Mega Guru

Hi @MarkWendilJhonD ,

Why are you using script include instead you can populate the email body from the email script itself.

Your script include is not working because you are passing current.request_item which is an object.
Take out the Glide part in script include and try to access required values from RITM object parameter.

 

If my solution works kindly mark it as correct answer and don't forget to click thumbs up button. 

MarkWendilJhonD
Tera Expert

As per thorough investigation, there is a query business rule on the Requested item table and the 'system' user does not meet the condition to query the Requested item table. To fix this, I only added a gs.interactive condition in the BR script.