Record Producer variable mapped to journal field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 01:49 PM
I have a record producer with a Notes variable (Multi line text). It currently maps to a string field on the table and that works fine. But when more notes are added to the record, they just append to the previous and becomes difficult to read/manage. I wanted to change the variable to map to a journal field instead so that I could more easily extract the most current note, but after I changed the mapping, nothing was transferred anywhere from the Notes variable.
Is there a trick to mapping to a journal field from a record producer?
TIA!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 01:53 PM
Hi Karla,
Unmap it and try this in your record producer script field (change the u_journal field and notes variable names accordingly)
current.u_journal_field = producer.notes; // copy producer's text field to final record's journal field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 02:53 PM
Thank you both for the quick (simultaneous!) responses. I have done no work with record producers before - this one was created by a 3rd party and now I'm attempting to make a few minor changes.
I tried your method above....
Steps:
Unchecked Map to field on the Notes variable
Commented line 33, added lines 34 and 55
Tested - no go.
Then I changed line 34 to:
gr.u_task_notes.setJournalEntry(producer.u_notes);
and line 55 to
current.u_task_notes.setJournalEntry(producer.u_notes);
Still no go.
What the heck am I doing wrong?
- createTimeEntry();
- function createTimeEntry(){
- var today = producer.entry_date;
- var dow = new GlideDateTime(today);
- dow = dow.getDayOfWeekUTC();
- var dtUtil = new DateTimeUtils();
- if (dow != 1) //if the day of the week is not Monday, determine what the date's time card week start day is
- var start = dtUtil.getWeekStart(today, 1);
- else
- var start = today;
- var reportingPer = String(producer.entry_date);
- reportingPer = reportingPer.substr(0,4) + reportingPer.substr(5,2); //string manipulation to grab reporting period date YYYYMM
- var user = producer.user;
- var gr = new GlideRecord('time_card');
- gr.addQuery('week_starts_on', start);
- gr.addQuery('user', user);
- gr.addQuery('u_reporting_period', reportingPer);
- gr.addQuery('u_company', producer.u_company);
- gr.addQuery('u_service_contract', producer.u_service_contract);
- gr.addQuery('task', producer.task);
- gr.addQuery('u_operational_task', producer.u_operational_task);
- gr.addQuery('category', producer.category);
- gr.query();
- var hours = parseFloat(producer.hours);
- if(gr.next()){ //Looking for any pre-existing timecards and updating them
- current.setAbortAction(true);
- if(gr.state == 'Approved'){
- gs.addInfoMessage("Time card has already been approved. No additional time can be entered.");
- return;
- }
- //gr.u_notes = gr.u_notes + ' ' + producer.u_notes;
- gr.u_task_notes = producer.u_notes;
- if(dow == 1)
- gr.monday = parseFloat(gr.monday) + hours;
- else if(dow == 2)
- gr.tuesday = parseFloat(gr.tuesday) + hours;
- else if(dow == 3)
- gr.wednesday = parseFloat(gr.wednesday) + hours;
- else if(dow == 4)
- gr.thursday = parseFloat(gr.thursday) + hours;
- else if(dow == 5)
- gr.friday = parseFloat(gr.friday) + hours;
- else if(dow == 6)
- gr.saturday = parseFloat(gr.saturday) + hours;
- else
- gr.sunday = parseFloat(gr.sunday) + hours;
- gr.update();
- producer.redirect= "time_card.do?sys_id=" + gr.sys_id;
- }
- else{ //No pre-existing timecard was found, update current record with inputted values
- current.week_starts_on = start;
- current.u_reporting_period = reportingPer;
- current.u_task_notes = producer.u_notes;
- if(dow == 1)
- current.monday = producer.hours;
- else if(dow == 2)
- current.tuesday = producer.hours;
- else if(dow == 3)
- current.wednesday = producer.hours;
- else if(dow == 4)
- current.thursday = producer.hours;
- else if(dow == 5)
- current.friday = producer.hours;
- else if(dow == 6)
- current.saturday = producer.hours;
- else
- current.sunday = producer.hours;
- }
- }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 03:19 PM
Not sure what to tell you Karla. I just took the out of box record producer for "Something is broken" that creates an incident. I added a multi-line text field for u_notes and copied them over to the incident's comments field like this:
Everything worked fine. (my text in the u_notes variable was "Comments go here")
Without being able to reproduce it, I'm not sure what to tell you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 01:53 PM