To send Notification to a variable of a cat item

rishabh31
Mega Sage

Hi Team,

Need help!

There is a notification on table sc_req_item, whose

When to send: Record Inserted or Updated (Inserted-True)

                          Condition: Item.Name is <Name of cat Item>

                                             And- Variables <Name of cat item> <name of variable> is <True>

 

I want to send this notification email to a variable of this cat item.

Variable (value): head_of_dept_name (Type-Reference (sys_user table))

 

I am unable to do dot walk into this variable of cat item from 'who will receive' > 'Users/Groups in fields' as I want to send this notification to the variable head_of_dept_name.

rishabh31_0-1683044989458.png

 

 

Please help!

1 ACCEPTED SOLUTION

Karan Chhabra6
Mega Sage
Mega Sage

Hi @rishabh31 ,

You can send that 'head_of_dept_name' field as a parameter via events and then in who will recieve section, select the checkbox 'event param1 contains recepient' or  'event param2 contains recepient'.

 

Please follow the below steps:

Step1: Create a new event by registering it in the event registry module

KaranChhabra6_0-1683053150966.png

You can name it according to your choice

KaranChhabra6_1-1683053292901.png

 

Step 2 : Create a new business rule on 'sc_req_item' table which runs before insert/update, select the 'advanced' checkbox

KaranChhabra6_2-1683053478657.png

KaranChhabra6_3-1683053861838.png

(function executeRule(current, previous /*null when async*/) {

	gs.eventQueue('ritm.creation.notification',current,current.variables.head_of_dept_name,gs.getUserName());

})(current, previous);

 

Step 3 : Open your notification record and click on 'advance view' ui action link, under when to send section

select 'send when' as 'event is fired' and select the event name that you created above

 KaranChhabra6_4-1683054040282.png

KaranChhabra6_5-1683054195040.png

 

Step 4: under who will recieve section, select the 'Event param1 contains recepient'

KaranChhabra6_6-1683054329677.png

 

This can be achieved via flows as well without the need of creating events.

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks,

Karan

View solution in original post

5 REPLIES 5

Nive
Tera Contributor

To send the notification email to the value of the variable head_of_dept_name which is of type Reference to the sys_user table, you can use dot-walking in the email notification's "who will receive" field.

In the "who will receive" field, you can use the following dot-walking expression to reference the value of the head_of_dept_name variable:

 

${sc_req_item.cat_item.head_of_dept_name.email}
 

This expression will retrieve the email address of the user referenced by the head_of_dept_name variable. The email attribute is used to retrieve the email address of the referenced user.

Note: This assumes that the referenced user has a valid email address in the sys_user table.

BharathChintala
Mega Sage

@rishabh31  Not possible

 

you have write br and call event pass user data in parm1 or parm2.

 

then change notification trigger to event fired in who will receive check parm1 or 2 contains recipients.

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

@BharathChintala sir tried to look for any such BR in community posts for reference but unable to find.

 

If possible can you please help me with the BR

 

Thank you

Karan Chhabra6
Mega Sage
Mega Sage

Hi @rishabh31 ,

You can send that 'head_of_dept_name' field as a parameter via events and then in who will recieve section, select the checkbox 'event param1 contains recepient' or  'event param2 contains recepient'.

 

Please follow the below steps:

Step1: Create a new event by registering it in the event registry module

KaranChhabra6_0-1683053150966.png

You can name it according to your choice

KaranChhabra6_1-1683053292901.png

 

Step 2 : Create a new business rule on 'sc_req_item' table which runs before insert/update, select the 'advanced' checkbox

KaranChhabra6_2-1683053478657.png

KaranChhabra6_3-1683053861838.png

(function executeRule(current, previous /*null when async*/) {

	gs.eventQueue('ritm.creation.notification',current,current.variables.head_of_dept_name,gs.getUserName());

})(current, previous);

 

Step 3 : Open your notification record and click on 'advance view' ui action link, under when to send section

select 'send when' as 'event is fired' and select the event name that you created above

 KaranChhabra6_4-1683054040282.png

KaranChhabra6_5-1683054195040.png

 

Step 4: under who will recieve section, select the 'Event param1 contains recepient'

KaranChhabra6_6-1683054329677.png

 

This can be achieved via flows as well without the need of creating events.

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks,

Karan