Gliderecord SetValue on Catalog Item variables

Tadz
Tera Guru
Tera Guru

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

tanumoy
Tera Guru

Yes... it is possible. Is you code not working?


yeah its not working.



i also tried.


var variableName = 'test';


var gr = new GlideRecord('sc_task');


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


  gr.query();



  if(gr.next()){


gr.variables.variableName   = 'desired_value';


  gr.update();


  }


Give gs.log(gr.getRowCount()) ; after       gr.query(); to check if you are able to get the record..




Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.


Deepa Srivastav
Kilo Sage

I didn't understand completely but do you mean you want to set a variable using GlideRecord ? Check if below link helps.



Glide Record Query in Workflow



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.