Call to Record Producer

tysonwenger
Mega Expert

Hi,

I'm working with ServiceNow default Call Application.   I'm trying to incorporate transferring a Call to a "Record Producer" because this functionality is not there.     I was hoping someone could help me with the basic design that I should follow to build this.   Steps needed for success:

1) Create new Call Type called Record Producer (*completed)

2) Allow user to select the specific Record Producer in another field (*completed)

3)   When the user saves the Call Form, open the form from the selected Record Producer (*completed)

Things I'm not sure of:

4)   Transfer the Call ID to the Record Producer Form.   (maybe a hidden field)

5)   When user saves the Record Producer Form, Transfer the Call ID to the "Task" Form

6)   Add Business Rule on Insert Task Table, and set script to look for Call ID value.   If it's not blank, update the Call Record with the newly created Incident ID.

7)   The call form should now hold a reference to the Incident that was created from a Record Producer.

(I couldn't find a generic way to do this for all record producers, it would have to be specifically set for each one)

Does that sound like a viable series of steps to accomplish the development task?   Is there a better way?

Thanks for any help!

-Tyson

4 REPLIES 4

Nolan3
Kilo Guru

Hello Tyson,



I don't have the answer to your questions but was wondering how you were able to do steps 1-3?   Thanks for your help in advance.  



Nolan


dvp
Mega Sage
Mega Sage

4)Transfer the Call ID to the Record Producer Form.   (maybe a hidden field) ->   Hidden field will not work as the you need to parse the URL and set the values using client script


5)   When user saves the Record Producer Form, Transfer the Call ID to the "Task" Form     --> this assumes that record producer and call relation will only needed for either a task or task table as parent.



6)   Add Business Rule on Insert Task Table, and set script to look for Call ID value.   If it's not blank, update the Call Record with the newly created Incident ID.


7)   The call form should now hold a reference to the Incident that was created from a Record Producer.


(I couldn't find a generic way to do this for all record producers, it would have to be specifically set for each one)




-----


You are correct. We cannot relate a record producer to call very easily



from the design side


you need to have a variable on every record producer that holds the call sys id (NEW_CALL_REF), also a catalog client script to parse URL and see if there is a call sys_id. (This can be generalized a little bit by using a variable set.)



Also to make it even simple... hope that all the Record producers are going to be on tables that has task as a parent. If it is the case with you, then create a new field on task table to save the NEW_CALL_REF id and write a business rule on task whenever the field has an sys_id of call.



For reference see Link back to the call that generated it business rule which relates call to request


tysonwenger
Mega Expert

Yep, DVP is right on the hidden field.   You need to send the information to the record producer through the URL and retrieve the information by parsing.   I created a new BR on the call table (new_call) which executes when the call type changes to "record producer" or whatever you call it.     See example:



function onAfter(current, previous) {


          var reqFor = current.caller;


          var location = current.caller.location;


          var recProducerItem = current.u_incident_predefined;


          var comments = "NEW_CALL_REF:"+current.sys_id+" "+current.description;   //pass the comments to the record producer


          var callID = current.sys_id;   //pass the call sys_id to the record producer


          var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + recProducerItem + '&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments + '&sysparm_callid=' + callID;


          action.setRedirectURL(url);


}



Then I added a field onto a variable set that I reused for all of my Record Producers called "OpeningCall".     In this variable set, I used an onLoad catalog client script to populate this field by parsing the URL.



function onLoad() {


    //Populate the variables with the parameters passed in the URL


    //Use the 'getParmVal' function below to get the parameter values from the URL


    var callID = getParmVal('sysparm_callid');


    if(callID){


          g_form.setValue('OpeningCall', callID);


    }


    g_form.setReadonly('OpeningCall',true);


    g_form.setDisplay('OpeningCall', false)


}



function getParmVal(name){


      var url = document.URL.parseQuery();


      if(url[name]){


              return decodeURI(url[name]);


      }


      else{


              return;


      }


}



Finally, in the record producer script push the new "incident" number (or whatever it is) back to the "transferred_to" field of the original call table.   (Additionally I added a new field to the base "Task" table called "u_call" which holds a reference to the call number as well for reference purposes).



//Pushing the Initial Call Record to the Incident form if it has been preset.  


//When a call record is created and the CSC person transfers the call to a record producer, we must capture


//the Call ID and pass this along to the Incident Form for reference purposes.


if (!producer.OpeningCall.nil()){


  current.u_call = producer.OpeningCall;


  //updating the transferred_to field in the call record to the incident reference


  var cal = new GlideRecord("new_call");


  if (cal.get(current.u_call)){


    cal.transferred_to = current.sys_id;


    cal.update();


  }


}




Hope that helps.



~Tyson


sathishk
Mega Contributor

Thanks for this post tysonwenger, it really helped and works.