How to set Contact Type to Self-Service when Ticket Submitted in Portal

Chris Sanford1
Kilo Guru

I would like to use the contact type field to track when tickets are submitted in the portal. Is there any easy way to set the contact type to a particular value such as 'self service' when it comes through in the portal?

I have read existing posts which discuss doing it in the record producer script, but what if I am not using a record producer but instead just using the 'form' page/widget?

7 REPLIES 7

venkatiyer1
Giga Guru

Hi,

First i would see if i can set the contact type on creation of the record from the widget itself.
Because you would be using the out of the box scripted rest api to create the item and you should be able to set it via the widget itself. 

As an alternative,
I would use something like the way Track approval source Business rule works on Approval table.

So i would create the following script in my widget before the creation of the request
var controller = new GlideController();
controller.putGlobal("contact_type", "self-service");
After creation of the request please clear the global value
controller.removeGlobal("contact_type");

In my sc_Req_item, i will have a business rule on insert which will check for contact_type and update it on the record


var controller = new GlideController();
var contact_type = controller.getGlobal("contact_type");

Hi Venkatiyer,

Can you elaborate more, please. Should this be scripted in the widget - 'SC Catalog Item' or something else.?

 

Regards 

S Rajkumar

Matthew Smith
Kilo Sage

Hi Chris

Do you force a view on the users when providing a link to the form page e.g. https://yourinstance.service-now.com/sp?id=form&table=incident&sys_id=-1&view=portal ?

If so, then I was able to get this functionality by creating an onSubmit Client Script with the below configuration:

find_real_file.png

Hope it helps.

Matt

Do I need to add Contact Type to the form for that to work? I was hoping not to expose that field on the form.