The CreatorCon Call for Content is officially open! Get started here.

Midilesh
Tera Contributor

Auto-Populate "Contact Type" field to "Self-service"  on REQ,RITM,SCTASK forms when a request is submitted from service portal.

 

note: All traces of service portal related requests and views are stored on  sp_log table.

I have written a  before insert Business Rule  on sp_log table 

There is this field "ID"  it points to the Request number.

(function executeRule(current, previous /*null when async*/ ) {

    var id = current.id;
    var grREQ = new GlideRecord("sc_request");
    grREQ.addQuery("sys_id", id);// 
    grREQ.query();
    if (grREQ.next()) {
        grREQ.contact_type = "self-service";

    }

    grREQ.update();

})(current, previous);

 

Note: we will only make these changes on REQ form and use the dot-walked field on RITM and SCTASK

Comments
Community Alums
Not applicable

Can you tell me How to Auto-Populate "Contact Type" field to "Self-service"  on Incident form when an incident is submitted from self-service view ? can we use UI Policy for this ?

Dan Covic2
Tera Contributor

@Community Alums sure you can! 

Have a look at this short tutorial on how to achieve this: https://www.youtube.com/watch?v=datpHpPj6bE&ab_channel=SAASWITHSERVICENOW

 

In your case, change the type of the Client Script to onSubmit instead of onLoad. And it should work.

Version history
Last update:
‎06-21-2022 11:15 PM
Updated by: