How to put sys_properties to script include then call it in Business rule?

Summer
Kilo Contributor

Hi! Can you guys help me with this one?? 

My requirement is to transfer the variables (sys_properties) in Script Include then just call it in Business rule.

Note: the sys_property has the sys_id of the email notification

find_real_file.png

 

What I did was I created a script include

 

find_real_file.png

 

Then I tried to call it in Business Rule:

 

find_real_file.png

 

 

RESULT: 

It seems that it is not getting the sys_id of the email notification because it is showing "empty here"

find_real_file.png

 

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

You don't have return statement in your script includes, that's why its not assigning any value in BR.

Please add return statements such as

return gs.getProperty(.....

Best Regards
Aman Kumar

View solution in original post

5 REPLIES 5

Aman Kumar S
Kilo Patron

You don't have return statement in your script includes, that's why its not assigning any value in BR.

Please add return statements such as

return gs.getProperty(.....

Best Regards
Aman Kumar

Sagar Pagar
Tera Patron

Hi,

 

You can directly call the system properties into Business rule. instead of getting into script include & call it in business rule.

 

var your_variable = gs.getProperty('property.name');

 

You can refer the article:System Properties & its Usage

 

Thanks,

Sagar Pagar

 

The world works with ServiceNow

Yes. that's what I did but there are so many sys_properties right now in the br and they wanted to transfer it in script include and just call it in business rule

Snehangshu Sark
Mega Guru

Hi Summer,

 

The return statement is missing here, the rest of all are correct.

 

Regards,

Snehangshu Sarkar