We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Expense Lines - Is there a way to know who processed the expense?

Onoderav
Tera Contributor

Hi, guys!
Concerning expense lines, client requested a field in the fm_expense_line list that shows the user who processed the expensive. I haven't found anything that shows this kind of information. Someone knows if there's a way to achieve this?
Thanks in advance.

1 ACCEPTED SOLUTION

Iraj Shaikh
Mega Sage

Hi @Onoderav 

Please follow the steps below to accomplish your requirement

1. Create new field on fm_expense_line table and reference it to the "User [sys_user]" table.

IrajShaikh_0-1705133656068.png

 

2. Create a new business rule that triggers "before" an insert or update on the fm_expense_line table.

Filter condition: State changes to Processed

Srcipt:

 

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

    current.u_processed_by = gs.getUserID();

})(current, previous);

 

 

 

Screenshot 2024-01-13 at 1.48.43 PM.png

Screenshot 2024-01-13 at 1.52.15 PM.png

 

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

1 REPLY 1

Iraj Shaikh
Mega Sage

Hi @Onoderav 

Please follow the steps below to accomplish your requirement

1. Create new field on fm_expense_line table and reference it to the "User [sys_user]" table.

IrajShaikh_0-1705133656068.png

 

2. Create a new business rule that triggers "before" an insert or update on the fm_expense_line table.

Filter condition: State changes to Processed

Srcipt:

 

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

    current.u_processed_by = gs.getUserID();

})(current, previous);

 

 

 

Screenshot 2024-01-13 at 1.48.43 PM.png

Screenshot 2024-01-13 at 1.52.15 PM.png

 

Please mark this response as correct or helpful if it assisted you with your question.