- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 03:57 AM
When using the variable "Attachment" the attachment is not included in the form.
In history I see its included:
But on the form (backend) I dont see an attachment:
On the front (ticket form), I see the attachment in the conversation:
But on the same screen the attachment is empty:
Anyone can help me out?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 08:30 AM
Sorry, I adapted this from another table and had a typo. In any event, testing this specific scenario I have found that it seems to work better, which means actually work in this case, if the Business Rule is async instead of after. You'll also want to create the BR in the Global scope since you're updating a global table.
Here's the working script, using a better way to specify the table name, which will make it easier to apply the same to other tables.
(function executeRule(current, previous /*null when async*/) {
var attach = new GlideRecord('sys_attachment');
attach.addQuery('table_name', 'ZZ_YY' + current.getTableName());
attach.addQuery('table_sys_id', current.sys_id);
attach.query();
if(attach.next()){
attach.table_name = current.getTableName();
attach.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 03:53 AM
Hi Brad,
Thanks again for your reply. I did everything like you told me to configurate.
I'm very new in the scripting part. Do I need to change parameters in the script to get it working? Now I just copied/pasted it in the BR.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 04:30 AM
Inactivate the first BR you created, then create a new one in the Global application the same way you created the first one, except with the updated script I provided.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 06:34 AM
Yes! Its working now. I don't know what went wrong. This morning I deleted the old BR, made the new one and it was not working. Now I tried it again, and its working!
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 05:50 AM
Hi Brad,
Thanks for your fast reply. I just verified and the table is named ZZ_YYsn_customer_service_case.
I'm trying to setup a proper Business Rule. I'm clearly doing something wrong, because it doesn't work the way that I configured it.
When to run:
Actions:
Advanced:
If I like look under tables, I don't see a table named: sc_customerservice_case. I tried renaming it in the script to sn_customerservice_case. This doesn't matter.
Can you help me configure this rule?
Thanks again!