Redirect to incident form in workspace view

simransagar767
Tera Contributor

I am trying to redirect to incident form from a button called "create incident" and set some fields value through url link only . so this is the link I am using to redirect

'incident.dosys_id=-1&sysparm_query=caller_id='+callerId+'%5Eu_call_id='+callId+'%5Econtact_type%3Dphone'+'&sysparm_stack=u_ivr_records_list.do'. 
this is working fine ,now I want same thing to happen in service operation workspace view . It should redirect to incident and set field value in incident in workspace view.
what changes I should make in url?
3 REPLIES 3

Viraj Hudlikar
Giga Sage

Hi @simransagar767 

First check what view is used when record is created from workspace and try to apply same view on existing record then just grab url and you will see parameter stating view copy it and append in your URL.

I tried it by doing this:
ServiceNOWInstanceName/incident.do?sys_id=-1&sysparm_query=active=true&sysparm_stack=incident_list.do?sysparm_query=active=true&sysparm_view=sow_new_record




adityakush24
ServiceNow Employee
ServiceNow Employee

Hi @simransagar767 
You can follow the below url pattern
For opening in classic UI - <instance-url>/incident.do?sys_id=-1&sysparm_query=short_description=test^caller_id=62826bf03710200044e0bfc8bcbe5df1&sysparm_view=sow

For opening in SOW - <instance-url>/now/sow/record/incident/-1/params/query/short_description=test^caller_id=62826bf03710200044e0bfc8bcbe5df1

Please mark it helpful if it answers your query.

Thanks,
Aditya Kushwaha

-O-
Kilo Patron
Kilo Patron

To do the same in a workspace button Workspace Client Script, you could write:

var targetRecordClassName = 'incident';
var encodedQuery = 'short_description=New record test^caller_id=62826bf03710200044e0bfc8bcbe5df1';
g_aw.openRecord(targetRecordClassName, '-1', { 'query': encodedQuery, });