Update task through inbound action

Community Alums
Not applicable

Hi all,

We have inbound action on incident table to create and update incident based on conditions, now i want to update task if any Task number present email subject, through same action.

could some one help me on this

Regards,

Roopa

5 REPLIES 5

Manoj Kumar16
Giga Guru

You can change the target table name- to task or sc_task(if it is catalog task) and change the current. field names with the task fields.


Capture.jpg


Hi,



you have to give type as Reply and based on your requirement give the condition, it will be some thing like below.



find_real_file.png



Please refer below link for more information.


http://wiki.servicenow.com/index.php?title=Inbound_Email_Actions#gsc.tab=0


prashantatsastr
Giga Expert

Hi Roopa,



As per your question, I would suggest to approach the problem in a way to first check whether the TASK number exist in the email subject.



e.g.:


if( email.subject.indexOf('TASK') >=-1)


{


// code to update task



var taskNumber = email.subject.substr(start, length); // Please use the start point and length of task number in email subject. e.g: for TASK000001


                                                                                                                                                                      //   email.subject.substr(0, 10); if start point is beginning of email subject.


var gr= new GlideRecord('task');


gr.addQuery('number', taskNumber);


gr.query();



while(gr.next())


{


gr.comments= 'Task Updated'; // Provide your update comments here


gr.update();



}



}



else


{


// code to update incident



}



Please let me know if you need more details.




PS - Please Hit Like, Helpful or Correct based on the impact of the response.


Community Alums
Not applicable

Thanks Prashant,



I was exactly looking this...



Regards,


Roopa