We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Gliderecord SetValue on Catalog Item variables

Tadz
Kilo Sage

Hi,

Is it possible to Gliderecord a catalog item variable value using setValue?

For example:

var variableName = 'test';

var gr = new GlideRecord('sc_task');

  gr.addQuery('request_item',current.document_id);

  gr.query();

  if(gr.next()){

gr.setValue(variableName, 'desired value');

  gr.update();

  }

Thanks,

Tadz

1 ACCEPTED SOLUTION

seanpatrick
Giga Contributor

Hi Tadz,

 

You may try this:

var variableName = 'test';

var gr = new GlideRecord('sc_task');

  gr.addQuery('request_item',current.document_id);

  gr.query();

  if(gr.next()) {

    //gr.setValue(variableName, 'desired value');

    gr.variables[variableName] = 'desired value';

    gr.update();

  }

 

__________________

Warm regards,

Sean

View solution in original post

11 REPLIES 11

seanpatrick
Giga Contributor

Hi Tadz,

 

You may try this:

var variableName = 'test';

var gr = new GlideRecord('sc_task');

  gr.addQuery('request_item',current.document_id);

  gr.query();

  if(gr.next()) {

    //gr.setValue(variableName, 'desired value');

    gr.variables[variableName] = 'desired value';

    gr.update();

  }

 

__________________

Warm regards,

Sean

Thanks for this Sean 😄