Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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 😄