Not able to insert into Journal field through Glide Record in Service Catalog

vallamreddyvenu
Giga Contributor

Hi,

We are creating a service catalog in which we have a variable named comments that is mapped to "Journal Input" type. In the catalog client script we need to insert into the table using GlideRecord. But when i assign a value to the journal field, the script is not working. If i comment the line assigning value to Journal field, the script is working.

Below is the script.

var gr = new GlideRecord('u_requests');

  gr.initialize();

  gr.short_description = "Test Title";

  gr.description = "Test Description";

  gr.u_caller_id = "RequestedFor";

  gr.cmdb_ci = "Environment";

  gr.u_request_start_date = "05/16/2017";

  gr.comments= "Test Comments";

  //gr[comments].setJournalEntry(Comments);

  gr.u_product = "Product Name";

  gr.insert();

Can somebody please check my script above and correct the mistake that i am doing?

Thanks,

Venu

13 REPLIES 13

comments is a journal field and you cannot do this with a client script. See my notes above about moving this logic to a server script.


BALAJI40
Mega Sage

Just use,


gr.comments= "Test Comments";



if you add comments to journal value activity stream it will updates..


Hi Balaji,



Thanks for your reply. May you please elaborate your statement "if you add comments to journal value activity stream it will updates.."



Thanks,


Venu


Matt Hernandez
Tera Guru

I tried to use this post to add some text into work_notes field of incident gliderecord, before the .insert(). The only way it would work was with: 

grInc['work_notes'].setJournalEntry("the text I want in the note");

Your example syntax of gr[comments] does not work because it doesn't have quotes around the field name. This was a London instance.