need to fetch task number from the email body

srinidhi
Tera Guru

Hello All,

 

I need to fetch sctask number from the email body and I need to update the record.

please help me with the script.

example number: SCTASK1234567.

 

Thanks.

1 ACCEPTED SOLUTION

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Below is example of fetching number from Subject, you can replicate for body as well.

https://www.servicenow.com/community/service-management-forum/need-to-extract-incident-number-or-cha...

Please hit like and mark my response as correct if that helps
Regards,
Musab

View solution in original post

13 REPLIES 13

@srinidhi 

are you sure your query is correct? and you are having record into stock room table

st.addQuery('name', status)

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

Thanks, got the issue. My query was fetching only sys_id. i used below syntax to get the field value.

 

 var statusReference = task.u_digilocker.getRefRecord(); // Get the referenced GlideRecord
    if (statusReference.isValid()) {
        var status = statusReference.name; // Access the 'name' field of the referenced record
        gs.info('namee: ' + status);

My initial link about fetching number from email body works for you so kindly accept the solution and close the thread.

Please hit like and mark my response as correct if that helps
Regards,
Musab

@Musab Rasheed  Accepted the solution,

Thanks.