I want to copy incident short description value from current incident to catalog item view of a specific item like "Standard Laptop"?

Shantharao
Kilo Sage

Hello All,

I want to copy incident short description text from current incident to "catalog item view" of a specific item like "Standard Laptop"?

for example I have entered text in short description field in my current incident form as below and I need to copy same text into Description variable of "Standard Laptop" catalog item, Please find the screen shots below incident form short description and "Standard Laptop" catalog item view

NOTE : I have a "Create Request" UI Action on incident form when I have been clicked on it, it will move to "Standard Laptop" catalog item view but not coping incident short description into "Standard Laptop" item description variable

UI Action code below : 

find_real_file.png

Incident Short Description

find_real_file.png

Standard Laptop catalog item view

find_real_file.png

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Shantharao,

You need to send the value from url example below highlighted in bold

Also you should not hard code the instance name, you can directly give the url of the try it page

var description = current.short_description;

var url = '/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=1fe8259c4fba5740fc11fa218110c796&sysparm_description=' + description;

action.setRedirectURL(url);

write an onLoad client script and fetch the parameter value and use setValue

function onLoad(){

var description = getParmVal('sysparm_description');
g_form.setValue('<variableName>', description);

}

function getParmVal(name){
    var url = document.URL.parseQuery();
    if(url[name]){
        return decodeURI(url[name]);
    }
    else{
        return;
    }
}

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hello Ankur,

 

Thanks for the reply it is working fine in backend view but it is not populating in service portal, 

Any solution is appropriated, I have written onLoad client script UI type =  All even though it is not working    

Shantharao
Kilo Sage

This link has given me an answer, it working great by using putClientData and getClientData methods

https://community.servicenow.com/community?id=community_question&sys_id=9dbf366ddb58dbc01dcaf3231f9619a0