The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Need help to fetch values for inbound action email

David Cross
Tera Expert

Hello All,  I have a inbound action to create a new catalog item & i want to fetch the below values to the variables.

Please help me fetch the value from in the below format so that i can update them in my variables

In the image, Its a table format. Please help,  
 
UID: XXXXXXX
Employee Name :XXXXXXX
LWD :XXXXXXX
Category :XXXXXXX
Cost Code :XXXXXXX
Buisness Line : XXXXXXX
Department : XXXXXXX

8 REPLIES 8

Sagar Pagar
Tera Patron

Hi,

I would suggest to use the data in table format.

UID:
XXXXXXX
Employee Name :  
LWD : XXXXXXX
Category : XXXXXXX
Cost Code : XXXXXXX
Buisness Line : XXXXXXX
Department :
XXXXXXX

 

Take a look at old thread - How to retrieve value from a table in an inbound action

How can I get table data from an inbound action

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Clients are not ready to change the format, Even i told them to use the above format. Any help on my code

 var cartId = GlideGuid.generate(null);
    var cart = new Cart(cartId);

    var item = cart.addItem('1b6f95971b10151053248dc5464bcb53');
    var htmlcode = email.body_html;
   htmlcode = htmlcode.replace(/<style([\s\S]*?)<\/style>/gi, '');
    htmlcode = htmlcode.replace(/<script>/gi, '');
    htmlcode = htmlcode.replace(/<\/div>/ig, '\n');
    htmlcode = htmlcode.replace(/<\/li>/ig, '\n');
    htmlcode = htmlcode.replace(/<li>/ig, '  *  ');
    htmlcode = htmlcode.replace(/<\/ul>/ig, '\n');
    htmlcode = htmlcode.replace(/<\/p>/ig, '\n');
    htmlcode = htmlcode.replace(/<br\s*[\/]?>/gi, '\n');
    htmlcode = htmlcode.replace(/<[^>]+>/ig, '');
    htmlcode = htmlcode.replace('  ', '');

    htmlcode = htmlcode.replace(/\r?\n|\r/g, '');

    var indesREG = new SNC.Regex('/Dear All.*Please visit the link below and/si');


    var finalvalue = indesREG.match(htmlcode).toString();
    gs.log("final email String  " + finalvalue);


    cart.setVariable(item, "user", "b30057786fe50600d1188f6f5d3ee4c6");
    //  cart.setVariable(item, "employee_name", "b30057786fe50600d1188f6f5d3ee4c6");
    //  cart.setVariable(item, "last_working_day", "b30057786fe50600d1188f6f5d3ee4c6");
    //  cart.setVariable(item, "category", "b30057786fe50600d1188f6f5d3ee4c6");
    // cart.setVariable(item, "cost_code", "b30057786fe50600d1188f6f5d3ee4c6");


    var rc = cart.placeOrder();

    sys_email.instance = rc.sys_id;
    sys_email.target_table = current.getTableName();

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

You already asked this question 4 hours ago where I already responded with the link having the solution

Any reason to post this new question?

Regards
Ankur

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

Yes, I asked here again.
 I am not able to fetch the desired output like , I tired to search different option but could not find any, please help me here to fetch values like below.
 
 
 UID: XXXXXXX
Employee Name :XXXXXXX
LWD :XXXXXXX
Category :XXXXXXX
Cost Code :XXXXXXX
Buisness Line : XXXXXXX
Department : XXXXXXX