Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add Attachment to Multi Row Variable Set

Kelvin16
Tera Contributor

Hello,

I have a requirement to add individual attachment in Multi Row Variable Set in service catalog.

We want to capture each variable data in a grid layout with attachment in service catalog.  I am not sure where to start.

(for example)

find_real_file.png

Can anyone share their widget or any idea where to start?

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Kevin,

You cannot add attachment within MRVS

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Please find the below Link to add the attachment type of variable in the mrvs 

https://community.servicenow.com/community?id=community_article&sys_id=ff89e9f51b789110c16b43f6fe4bcb02

Hi @Kelvin16 @Harshal Gawali 

 

Below is the business rule restricting the attachment of multirow variables, if you want to attach attachment to associated requested item, please refer to the logic below that I have implemented on my instance and it is working as expected.  

 

You can remove the condition from the below business rule.

 

 Business rule Name: Restrict types for table variable set

able: Variable[item_option_new]

 

Table: Request [sc_request]
When to Run: After Insert
Script:
 

var grRitm = new GlideRecord('sc_req_item');
grRitm.addQuery('request', current.sys_id);
grRitm.query();
while (grRitm.next()) {
var gr1 = new GlideRecord('sc_multi_row_question_answer');
gr1.addQuery('parent_id', grRitm.sys_id);
gr1.addQuery('item_option_new', 'MRVs variable sys_id');
gr1.query();
while (gr1.next()) {
var attchment = new GlideRecord('sys_attachment');
attchment.addQuery('sys_id', gr1.value);
attchment.query();
while (attchment.next()) {
attchment.table_sys_id = grRitm.sys_id;
attchment.table_name = 'sc_req_item';
attchment.update();
}
}

}

 

priti4_0-1676264569005.png

 

Hi, 

When i try this approach, on the attachment variable i only see the string with the name of the file.

Any idea why this might be?

mipalm_0-1706200274722.png

mipalm_1-1706200312023.png

 

 

Thanks in advance!