Auto-Populate "Contact Type" field to "Self-service" on REQ,RITM,SCTASK
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
https://www.servicenow.com/community/developer-articles/auto-populate-quot-contact-type-quot-field-to-quot-self-service/ta-p/2305409