Identify if an Incident or Catalog Item has been raised from NOW mobile App

Subhajit Mukhe1
Kilo Expert

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.

1 ACCEPTED SOLUTION

Steps:

 

Create one event here 

Go to module system policy >> Events >> registry. 

Screenshot for reference. 

 

find_real_file.png

 

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. 

View solution in original post

12 REPLIES 12

MrMuhammad
Giga Sage

HI,

Unfortunately, this functionality is not available OOB. You can look at workaround at below thread.

https://community.servicenow.com/community?id=community_question&sys_id=7a11c99cdbd994102be0a851ca96...

In addition you can set Default value of UI parameter as Mobile for contact_type.

Also, I had opened an idea about this. Feel free to upvote that.

https://community.servicenow.com/community?id=view_idea&sysparm_idea_id=28d4c9b9db651410f7fca851ca96...

 

Thanks & Regards,

Sharjeel

 

Regards,
Muhammad

Hi, I have updated the contact type in incident as Mobile App while creating incident from Report Issue button in My Locker applet. But suppose I am opening the create incident record producer from Browse Services section in Services page which is opening the catalog item itself. How can we change contact type to mobile app from there based on NOW mobile or portal.

I think in that case we cannot detect the device whether it's coming from the Mobile app or Service portal. As we don't have any API available that we can leverage in script to detect Mobile app. 

Regards,
Muhammad

There is a workaround to do this, but can you confirm are you only going to submit record producer via portal and now mobile app or you will also use native ui catalog form?