Notifications

322 views

Description

When adding a company image to a child domain record while in a parent domain, the image will not show while viewing form in said parent domain. This is because the banner image attachment takes the session domain of the user who added it instead of the domain of the company record.

Steps to Reproduce

 

  1. Activate the Domain Support - Domain Extensions Installer plugin.
  2. Create the following domains:
    1. TOP => LEVEL1
    2. TOP => LEVEL1 => LEVEL2
    3. TOP => LEVEL1 => LEVEL2 => LEVEL3
  3. Create a company in the LEVEL3 domain.
    • Note: It may be necessary to add the Domain field to the core_company form.
  4. In the core_company record for the company just created, add a banner image.
    • It may be necessary to add the Banner Image field to the core_company form.
  5. Navigate to the sys_attachments table and find the record that was just added.
    • Rearrange the sequence by Created (descending), and look for a record with file name of banner_image and table name of ZZ_YYcore_company.

Expected result:

The domain of sys_attachment record will match the domain of the core_company record.

Actual result:

The domain of the sys_attachment record matches the domain that the currently logged in user had selected at the time (in this case, it should be global).

Workaround

Use the attached business rule to resolve this issue: sys_script_e53bbf9a4f013240137c4b8d0210c76a.xml.

Contents, 1 Business Rule:

Name: Set Domain for Banner Images (PRB679636)
Table: sys_attachment
Advanced: true
When: before
Insert: true
Filter Conditions: Table Name is ZZ_YYcore_company AND File name IS ONE OF banner_image,banner_image_light
(table_name=ZZ_YYcore_company^file_nameINbanner_image,banner_image_light^EQ)

Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here

var snc_cc = new GlideRecord("core_company");
snc_cc.get(current.table_sys_id);
if (typeof(snc_cc.sys_domain) == 'object')
  current.sys_domain = snc_cc.sys_domain;
})(current, previous);


Related Problem: PRB679636

Seen In

Fuji Patch 12
Geneva Patch 5

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-08-10 05:57:09
Published:2017-02-23
sys_script_e53bbf9a4f013240137c4b8d0210c76a.xml