- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 10:57 AM - edited 01-12-2024 10:57 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2024 12:24 AM - edited 01-13-2024 12:25 AM
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.
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);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2024 12:24 AM - edited 01-13-2024 12:25 AM
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.
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);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2024 12:52 AM
Sure, you can achieve this by creating a new field in the 'fm_expense_line' table to store the information of the user who processed the expense. You can then update this field whenever an expense is processed. Here are the steps:
1. Navigate to the 'fm_expense_line' table by typing 'fm_expense_line.list' in the left navigation filter.
2. Click on 'Configure' -> 'Table' to open the table schema.
3. Click on 'New' to create a new field.
4. Set the 'Type' to 'Reference', 'Label' to 'Processed By', and 'Reference' to 'User [sys_user]'.
5. Click on 'Submit' to create the field.
Now, you need to update this field whenever an expense is processed. You can do this by creating a Business Rule:
1. Navigate to 'System Definition' -> 'Business Rules'.
2. Click on 'New' to create a new Business Rule.
3. Set the 'Name' to 'Update Processed By', 'Table' to 'Expense Line [fm_expense_line]', and 'When' to 'before'.
4. Set the 'Insert' and 'Update' checkboxes to true.
5. In the 'Advanced' tab, write the following script:
javascript
(function executeRule(current, previous /*null when async*/) {
// Set the 'processed_by' field to the current user
current.processed_by = gs.getUserID();
})(current, previous);
6. Click on 'Submit' to create the Business Rule.
Now, whenever an expense is processed, the 'Processed By' field in the 'fm_expense_line' list will show the user who processed the expense.
nowKB.com