UI action on Demand Task with Demand fields

Naveen87
Tera Guru

Hello Developers,

 

I want to create a UI action on demand task table called 'create change'.

When this UI action is clicked, then a dialog window will pop-up of Change Request form .

This change should automatically fetch 90% of the details.

var encodedQuery = 'short_description=' + g_form.getValue('short_description') +
        '^description=' + g_form.getValue('description') +
        '^u_service=' + g_form.getValue('u_service') + // Service Offering - CHG :: DTASK values
        '^u_supporting_service=' + g_form.getValue('u_task_support') + // Support Offering - CHG :: DTASK values
        '^cmdb_ci=' + g_form.getValue('cmdb_ci')

var dialog = new GlideDialogForm('Create Change', 'change_request');
    dialog.addParm('sysparm_query', encodedQuery); //use this line to set value
    dialog.render();

I have successfully completed above configuration, I'm able to fetch fields which present of demand task table & pop-up at change form.

But there are few fields which are available only on Demand table & should be displayed at Change form.

I have tried g_scratchpad but this doesn't seems working.

Any guidance is much appreciated.

Naveen87_0-1724666037391.pngNaveen87_1-1724666053922.png

 

2 REPLIES 2

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

My suggestion would be,

Instead of popup redirect user to new Change form,

in the url you can pass the Demand Task/ Demand Number
On the change form, add a new onload client scripts that checks the url to se if there is any demand number present, if it is present then using glideAjax fetch and populate the demand details to change form,

-Anurag

Hi,

This configuration was already existing on Demand table with Dialog pop-up.

Now they wanna remove from  Demand as it can have only 1 change & put at Demand task so each task can have it's own change.

So I need to use same Dialog pop-up (can't make new changes as it will impact the performance, as a lot users must be educated on new things) & I don't want to make it complex by using Script Include & GlideAjax.

Hence used EncodedQuery & fetched most of the fields existing on Demand task but there are 4-5 fields which are required but are available on Demand table.

Tried with g_scratchpad, g_getReference, dot-walking but no luck.