- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2022 06:17 AM
I created a RP Producer and i want to create a case via my record producer and fetch some value.
here's my code , please help me regarding this.
on Producer Script :
I invoked script include in the producer script.
var gcp=new global.GC_INT_UTILS();
var sysIDoutput=gcp.CreateCase(producer);
sysIDoutput+=','+current.sys_id;
My Script include Code :
CreateCase: function(producer) {
var casessysIDS = [];
var caseGr = new GlideRecord('sn_customerservice_case');
caseGr.initialize();
var serviceGr = this.getActiveEntitlements(producer, producer.getValue('u_gc_sub_service' + i), producer.getValue('product_' + i));
if (JSUtil.nil(serviceGr)) {
return false;
}
if (serviceGr) {
gs.log(serviceGr);
caseGr.entitlement = serviceGr.sys_id;
caseGr.contract = serviceGr.contract;
caseGr.product = serviceGr.product;
caseGr.u_gc_service_line = serviceGr.u_gc_service_line;
caseGr.u_gc_service_group = serviceGr.u_gc_service_group;
caseGr.account = producer.account;
caseGr.priority = producer.getValue('priority_' + i);
caseGr.state = 1;
caseGr.contact_type = 'web';
caseGr.u_gc_bp_code = producer.account.u_gc_bp_code;
caseGr.opened_by = gs.getUserID();
caseGr.partner_contact = gs.getUserID();
caseGr.partner = producer.partner;
caseGr.u_gc_ref_num = producer.u_gc_ref_num;
var entGr = new GlideRecord("u_gc_sub_service");
entGr.setWorkflow(false);
entGr.addQuery('model_number', producer.getValue('u_gc_sub_service_' + i));
entGr.query();
if (entGr.next()) {
caseGr.u_gc_sub_service = entGr.sys_id;
caseGr.u_gc_sub_service_code = producer.getValue('u_gc_sub_service_' + i);
}
caseGr.u_gc_email_description = producer.u_gc_email_description;
var created = new GlideDateTime();
var tz = new GCTimezoneObject().getTimeZoneObject(accnGr.u_gc_timezone.toString());
var time = new GlideDateTime(created);
time.setTZ(tz);
var timeZoneOffSet = time.getTZOffset();
time.setNumericValue(time.getNumericValue() + timeZoneOffSet);
caseGr.u_gc_job_created_station = time.getValue();
}
var casesysID = caseGr.insert();
// gs.log(casesysID);
var attachGr = new GlideRecord('sys_attachment');
attachGr.addQuery('table_name', 'sn_customerservice_case');
attachGr.addQuery('table_sys_id', current.sys_id);
attachGr.query();
if (attachGr.next()) {
GlideSysAttachment.copy('sn_customerservice_case', current.sys_id, 'sn_customerservice_case', casesysID);
}
var case3sysID = '';
casessysIDS += ',' + casesysID;
return casessysIDS.toString();
},
Solved! Go to Solution.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2022 06:21 AM
Hi,
I see a variable i used in your script include. But it is not declared. Can you check whether it is expected?
Palani

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2022 06:21 AM
Hi,
I see a variable i used in your script include. But it is not declared. Can you check whether it is expected?
Palani