Icon/Picture in Record producer - facing issue for updating all record producers at a time

sri vijaya
Tera Contributor

Hi

we have 100+ record producers , so for icon/picture in record producer we want to update all of them at once

so created business rule and fix script 

and followed this process

  • Attaching the image in any one record producer
  • Now going to sys_attachment table and copying the sys id of the above step  
  • Attaching the sys id in both business rule and fix script to run

However this is working fine for us but as these are instance dependent activity as these are manual steps for each instance, so here when one record producer is moving from instance to other with other development activity/for any issue then sys id of icon is changing everytime which is image is missing everytime

so to avoid this is there any other solution to update image/icon in all record producers at a time?

@Ankur Bawiskar @Dr Atul G- LNG @Chaitanya ILCR @J Siva 

10 REPLIES 10

@sri vijaya 

there don't hard-code sysId

Instead do this

// get the attachment sysId using record producer sysId and then use that
var attSysId = '';
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_sys_id", "recordProducerSysId");
gr.query();
if (gr.next()) {
    attSysId = gr.getUniqueValue();
}


rp.picture = attSysId;

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@sri vijaya 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Ankur Bawiskar 

when i pasted this script and running the script , picture in all record producers are going to empty

Not sure where did i go wrong here

 

@sri vijaya 

please share your complete script.

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

srivijaya_0-1750220340568.png

@Ankur Bawiskar 

Here in line 18 i am adding the record producer sys id in which i am adding the picture as first step