need to create RITM based from email or outlook like based on email content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 06:09 AM
HI experts,
email content:
-----------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 10:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 11:09 PM
Hello @Purushotham Ga2
Your code updated:
function createRequest() {
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('f3ee4b5e93775e502235f2066aba105d');
if (!email || !email.body_text) {
gs.error("Email body is empty or undefined.");
return;
}
var emailbody = email.body_text;
gs.info("Email Body: " + emailbody); // Debugging email body
var emailLines = emailbody.split('*');
if (emailLines.length < 6) {
gs.error("Email body does not contain expected data.");
return;
}
var user_name = emailLines[0].split('User Name - ')[1]?.trim() || "";
var job_title = emailLines[1].split('Job Title - ')[1]?.trim() || "";
var ad_last_logon = emailLines[2].split('AD Last Logon - ')[1]?.trim() || "";
var azure_ad_last_sign_in = emailLines[3].split('Azure AD Last Sign-In - ')[1]?.trim() || "";
var manager_name = emailLines[4].split('Manager - ')[1]?.trim() || "";
var manager_email_id = emailLines[5].split('Manager Email ID - ')[1]?.split('\n')[0]?.trim() || ""; // Fix for extra data
gs.info("Parsed Values - User Name: " + user_name + ", Job Title: " + job_title);
cart.setVariable(item, 'user_name', user_name);
cart.setVariable(item, 'job_title', job_title);
cart.setVariable(item, 'ad_last_logon', ad_last_logon);
cart.setVariable(item, 'azure_ad_last_sign_in', azure_ad_last_sign_in);
cart.setVariable(item, 'manager_name', manager_name);
cart.setVariable(item, 'manager_email_id', manager_email_id);
var abc = cart.placeOrder();
gs.info("Order placed with ID: " + abc);
}
createRequest();
NOTE: Used onecompiler website to generate split and trim statements for your code.
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 10:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 10:20 PM
i used the above script to populate data based on variables matches but getting error like undefiened so please assist me asap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 10:24 PM
@Ankur Bawiskar/ @Vishal Jaswal - pls assist me on this asap