getClientData in server side?

Vijay27
Tera Guru

Hi Folks,

The below code is written in business rule,what the below highlighted code will do and what exactly this gs.getSession().getClientData('dontcopy') == 'true') means in  BR.

Because of this sometimes comments are not copying to SC_task.

if(gs.getSession().getClientData('dontcopy') == 'true'){
gs.getSession().putClientData('dontcopy', false);
return;
}

var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.query();
while(gr.next())
{
gs.getSession().putClientData('dontcopy', true);
gr.work_notes = current.work_notes;
gr.comments = current.comments;
gr.update();
}

 

Regards,

Vijay

2 REPLIES 2

Ct111
Giga Sage

Hi Vijay,

There is some value set by putClientDatain client script that is being fetched by this getClientData in business rule method.

To read more in details refer the below link:

 

https://developer.servicenow.com/app.do#!/api_doc?v=orlando&id=r_GlideSessionGetClientData_String

 

Mark my ANSWER as CORRECT and HELPFUL if it works.

 

Also refer what is being set by putClientData to understand in detail what this getClientData trying to do

 

ServiceNow SA
Kilo Guru

HI Vijay,

Did you find anything as how to use getClientData in server side?