- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 04:48 AM
Hi,
We have the create incident record producer in our Servicenow instance. End users can access it via service portal or NOW mobile app to raise an incident.
I wanted to know if we can differentiate between the incidents raised from create incident via service portal and NOW Mobile App, so we can set accurate contact type to the incident created.
This is required for reporting purposes.
Any approach or suggestion is appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 10:27 AM
Steps:
Create one event here
Go to module system policy >> Events >> registry.
Screenshot for reference.
Now create one script Action:
Go to module system policy >> Events >> Script Actions
var ID = event.parm1;
var grsp = new GlideRecord('sp_log');
grsp.addEncodedQuery('type=Task View^id='+ID);
grsp.query();
if(grsp.getRowCount() >0){
var gr = new GlideRecord('incident');
gr.get(ID);
gr.contact_type = 'self-service';
gr.update();
}
Now create one before business rule on incident table to trigger the eventQueueScheduled().
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gdt = new GlideDateTime();
gdt.addSeconds(4);
gs.eventQueueScheduled('rp.portal',current,current.sys_id,'Scheduled ' + gdt.getDisplayValue(),gdt);
})(current, previous);
now in record producer set one line in script
current.contact_type = 'phone';
Note: Now whenever you will submit the record producer from portal, incident contact type will set as "self sevice" and if you will submit from mobile app it will set as "phone".
This workaround will be only fit if you are handling record producer via portal and now mobile app.
Hope it will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 09:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 10:27 AM
Steps:
Create one event here
Go to module system policy >> Events >> registry.
Screenshot for reference.
Now create one script Action:
Go to module system policy >> Events >> Script Actions
var ID = event.parm1;
var grsp = new GlideRecord('sp_log');
grsp.addEncodedQuery('type=Task View^id='+ID);
grsp.query();
if(grsp.getRowCount() >0){
var gr = new GlideRecord('incident');
gr.get(ID);
gr.contact_type = 'self-service';
gr.update();
}
Now create one before business rule on incident table to trigger the eventQueueScheduled().
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gdt = new GlideDateTime();
gdt.addSeconds(4);
gs.eventQueueScheduled('rp.portal',current,current.sys_id,'Scheduled ' + gdt.getDisplayValue(),gdt);
})(current, previous);
now in record producer set one line in script
current.contact_type = 'phone';
Note: Now whenever you will submit the record producer from portal, incident contact type will set as "self sevice" and if you will submit from mobile app it will set as "phone".
This workaround will be only fit if you are handling record producer via portal and now mobile app.
Hope it will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2020 12:27 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2020 02:32 AM
Glad. It helped. have a great day 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2020 09:31 PM
Hello
Recently we created the portal in our organisation, Our client is asking me, How we can differentiate the catalog items submitted from the portal.
I have gone through couple of posts and it says if the "Requested By" and "Opened by" are same then it means that the request is submitted in the portal ( set contact type to Self- Service) and if it is different then set contact type to null on "SC Task " form .
Please suggest me if you have any alternative solution for this,
This is bit urjent, Please help me on this.
Thanks and Regards,
Tejaswini