We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Source field changes specifically on workspace

sonalpriyanka95
Mega Expert

I want when an request Item is created specially on workspace and Service desk agent clicks on SAVE then Source (contact_type) field should be Email, other wise when uses service portal then Source (contact_type) field should be Portal , tried through Client script it's working fine for portal but not on workspace.

 

Any suggestion how to acheive 

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@sonalpriyanka95 

how are the agents creating RITM from workspace?

are they submitting request from workspace?

share your screenshots, script and form etc

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

sonalpriyanka95
Mega Expert

whener we recieve any email through interaction we have given option to create req item

@sonalpriyanka95 

then you can try to use onLoad client script on sc_req_item and see if the URL contains workspace name, if yes then set the contact type

did you try above approach?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

I tried that but somehow  it's breaking for service portal then ,

I want particularly for sow workspaces it should be email , rest for service portal as Portal..

Please find the script below 

 

function onSubmit() {
    alert("running");
   //Type appropriate comment here, and begin script below
  // g_form.setValue("contact_type","portal");
    //g_form.save();

    if (window.NOW && window.NOW.sp) {
        g_form.setValue('contact_type', 'portal');
    } else {
        g_form.setValue('contact_type', 'email');
    }

}