How to copy attachment from rm_enhancement to rm_story

sinu2
Tera Expert

HI,

I have a requirement where , Copy attachments to story record from enhancement record.

 

FOr this already UI action in place but no glide ajax calling and no script include involved client callable checked.

 

In this case hoiw can we achive this.

 

existing code in ui action

 

function openFormDialog() {
    var sysId;
    if (typeof rowSysId == 'undefined')
        sysId = gel('sys_uniqueValue').value;
    else
        sysId = rowSysId;
    var gModalForm = new GlideModalForm('Create Story', 'rm_story');
    gModalForm.setPreference('sysparm_view', 'scrum');
    gModalForm.addParm('sysparm_query', 'short_description=' +
        g_form.getValue('short_description').replace(/\^/g, '^^') +
        '^description=' + g_form.getValue('description').replace(/\^/g, '^^') +
        '^assigned_to=' + g_form.getValue('assigned_to') +
        '^classification=Feature' +
        '^enhancement=' + sysId +
        '^sys_class_name=rm_story'
    );
    gModalForm.setCompletionCallback(function(action_verb, sys_id, table, displayValue) {
        if (action_verb == 'sysverb_insert') {
            if (typeof GlideList2 !== 'undefined') {
                if (GlideList2.get("rm_enhancement.rm_story.enhancement"))
                    GlideList2.get("rm_enhancement.rm_story.enhancement").refresh();
            }
        }
    });
    gModalForm.render();
}

 

 

2 REPLIES 2

Abhishek_Thakur
Mega Sage

Hello @sinu2 ,

You can refer the below article to move or copy the attachment from one table to another table.

https://www.linkedin.com/posts/abhishek-thakur-4636a722b_servicenowdeveloper-servicenowadmin-service...

 

Please mark my solution as accepted and give thumbs up, if it helps you.

Hi @Abhishek_Thakur 

 

since this is a client callable UI action Server code will not work. I tried just putting one log not working.

 

Thanks