- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 12:46 PM
That subject was probably ambiguous, but I'm trying to populate the phone record table (sn_openframe_phone_log_list) using a business rule on the case record from the CSM plugin. On the case record, I have the below part of a code built out. I am able to populate the phone log table with this, but the "task" column is a reference field that links the phone log record with the case record. No matter what I throw at it though, I can't get the phone log table record to populate with the current case ID. Any suggestions?
var gr = new GlideRecord('sn_openframe_phone_log');
gr.initialize();
gr.task = current.number;
gr.insert();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 01:22 PM
the record's 'sys_id' (gr.task = current.sys_id) is needed. Since the task field on the sn_openframe_phone_log table is a "Reference" field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 01:22 PM
the record's 'sys_id' (gr.task = current.sys_id) is needed. Since the task field on the sn_openframe_phone_log table is a "Reference" field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2022 06:05 AM
Much appreciated! I was rather close with one of my iterations. I knew it probably wasn't overly complicated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 02:30 PM
You may need "gr.task = current.sys_id.toString();". And I'm guessing you are using a Business Rule defined on the "sn_customerservice_case" table.
You can use "gs.info("myBusinessRule: creating record with task with reference to " + current.number + ".");" to see what in Scripts Log Statement module that the BR logic executes.
And change the "gr.insert()" to "var result = gr.insert();" and then log:
gs.info("myBusinessRule: New record sys_id is " + result + ".");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2022 10:01 AM
Your assumption was correct. It is a Business Rule defined on the "sn_customerservice_case" table.
I had it working with sys_id.toString() in November, but when trying it now i'm back to square one with not being able to populate with current case record. I have the rule to run on display (though I have tried the others without success). I was able to verify with logging that the value of the sys_id that the script is pulling is correct, but the phone log table is either not populating at all or is populating with a default task value.