Attachment popup in scoped application

Utkarsha
Tera Contributor

Hey everyone,

I am kind of looking to have 📎 paperclip attachment functionality on my existing form button.

I want once user clicks on it sample popup should appear as we have on records whenever we click on paperclip icon

Is there a way I can achieve this?  I tried using OOB ui page but it was throwing errors while displaying as this functionality supposed to be created in scoped application.

All kinds of suggestions are welcome here 🤗 

Thank you in advance!

4 REPLIES 4

DrewW
Mega Sage
Mega Sage

Do you want this for the Platform UI, Workspace or Service Portal?  Is there a reason the default attachment functionality is not good enough?

 

@DrewW ,

Thank you for responding on this.

I want this to be made available on form button 

No, actually the reason is I have a close button..so as soon as user tries to close the task he will be shown up that popup to add an attachment mandatorily.

We don't have paperclip icon enable on this particular table...it was there initially but later they disabled it.

Thanks,

Thanks,

So you want to replace the paperclip button at the top of the form that is in the same bar that all the other buttons are in.  Ok...

 

Well when I look at the HTML for that button it runs

saveAttachment('sys_dictionary', '<SYS_ID_OF_CURRENT_RECORD>');

 

and when I run that via the console the attachment dialog opens so maybe look into that.

Hello @DrewW ,

Thanks for sharing this info. I tried using below code in my UI action-
I am able to get the popup window to add an attachment but post that nothing is happening

I want system should if a single attachment is present on form , state should be moved to next stage i.e. closed

function uploadAttachment() {
    g_form.clearMessages();
    saveAttachment(g_form.getTableName(), g_form.getUniqueValue(), true);

    // Check if attachment added
    var att = new GlideRecord("sys_attachment");
    att.addQuery("table_name", g_form.getTableName());
    att.addQuery("table_sys_id", g_form.getUniqueValue());
    att.query();
    if (att.getRowCount() > 0) {
        updateStateToClosed();
    }
}

function updateStateToClosed() {
    current.state = '7'; // Assuming 'closed' is the state value for closed records
    current.update();
}