Incident Number in Record Producer

madanm7786
Mega Guru

Hi All,

Is there a way to get the incident number in record producer during submission.

I need to display a message(alert or addinfomessage) with Incident number to end users when incident is created from record producer.

Thanks,

Maddy

4 REPLIES 4

marcguy
ServiceNow Employee
ServiceNow Employee

once the record is inserted, in the insert() piece is done.



you can add a gs.addInfoMessage() to the record producer script to send a message back to the user.



gs.addInfoMessage('Your incident has now been created: ' + current.number); or something along those lines.



there's a good example on the 'Create Incident' out of the box incident record producer which reports back the number and a clickable link




var info = "This incident was opened on your behalf{0}The IT department will contact you if they need any further information{0}You can track status from this {1} {0}";



gs.addInfoMessage(gs.getMessage(info,msgArgs));


I checked in the OOB Create incident RP and also in our custom Create Incident RP, but there is no insert() used in the script.


marcguy
ServiceNow Employee
ServiceNow Employee

My mistake, you won't need the insert() as it already know where to insert a record.



But the gs.addInfoMessage piece still applies if you want to send a message back to the user on creation.



Thanks,


Marc


RiteshSwarnakar
Giga Guru

 

 

Record Producer Script:

 

var link = '<a href="incident.do?sys_id=' + current.sys_id + '" class="breadcrumb" >' + 'Click here to go to the incident.' + '</a>';
var msg = 'Incident: '+ current.number +' is created.<br/>'+ link;
gs.addInfoMessage(msg);
// Prevent redirection
producer.portal_redirect = 'javascript&colon;void(0)';      // &colon; should be replaced by only  :