Hello Guys,
Been trying to extract a specific part of the JQuery response below -
{
"ticket": {
"cc_emails": null,
"fwd_emails": null,
"reply_cc_emails": null,
"bcc_emails": null,
"fr_escalated": false,
"spam": false,
"email_config_id": null,
"group_id": ,
"priority": 1,
"requester_id": ,
"requested_for_id":
"responder_id": 1,
"source": ,
"status": ,
"subject": "HR Onboard(testing)",
"to_emails": null,
"sla_policy_id": ,
"department_id": ,
"id": 83,
"type": "Incident",
"due_by": "2022-08-16T02:08:08Z",
"fr_due_by": "2022-08-07T23:08:09Z",
"is_escalated": false,
"description": "<div style='font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;'><div style='font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;'><div style=\"\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"color: rgb(34, 34, 34); font-size: small;\"><tbody>\n<tr><td width=\"576\" style='font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;'><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td width=\"532\" style='font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;'>\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" width=\"800\" style=\"text-align: center;\"><tbody><tr><td style='font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;'>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"text-align: center;\"><tbody><tr><td width=\"721\" style='font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;' class=\"\">\n<div style=\"margin-bottom:15px;\">Hi there,</div>\n<div style=\"margin-bottom:15px;\" class=\"current\">Person has accepted an offer of employment for the position of Employment on 08/08/2022.</div>\n<div style=\"margin-bottom:15px;\" class=\"current\">Their hiring manager is Mr Hiring Manager at <a href=\"mailto:user.name@xxxxx.com\" target=\"_blank\" style=\"color: rgb(17, 85, 204);\" rel=\"noreferrer\" class=\"current\">user.name@xxxx.com</a> and they have been sent the forms for IT provisioning of access and equipment.</div>\n<div style=\"margin-bottom:15px;\">Please commence set up of the email address, network/system log-on and telephone number accordingly.</div>\n<div style=\"margin-bottom:15px;\">Also, the following provisioning will be required:</div>\n<ul><li style=\"margin-left: 15px;\">Laptop</li></ul>\n<div style=\"margin-bottom:15px;\"> </div>\n</td></tr></tbody></table>\n<div style=\"margin-bottom:15px;\"> </div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"text-align: center;\"><tbody><tr><td width=\"800\" style='font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;'><div style=\"margin-bottom:15px;\" class=\"current\">You are receiving this email as a notification regarding your employment.</div></td></tr></tbody></table>\n</td></tr></tbody></table>\n<div style=\"margin-bottom:15px;\"> </div>\n</td></tr></tbody></table></td></tr>\n<tr>\n<td width=\"576\" style=\"\">\n<div style=\"margin-bottom:15px;\"> </div>\n</td>\n</tr>\n<tr>\n<td width=\"576\" style=\"\" class=\"\">\n<div style=\"margin-bottom:15px;\" class=\"current\">Please do not hesitate to contact us if you have any questions.</div>\n<div style=\"margin-bottom:15px;\"> </div>\n<div style=\"margin-bottom:15px;\"><span style=\"\"> </span><br></div>\n</td>\n</tr>\n</tbody></table>\n</div>\n</div>\n</div>",
"description_text": "Hi there, \n Person has accepted an offer of employment for the position of Employment on 08/08/2022. \n Their hiring manager is Mr Hiring Manager at user.name@xxxx.com and they have been sent the forms for IT provisioning of access and equipment. \n Please commence set up of the email address, network/system log-on and telephone number accordingly. \n Also, the following provisioning will be required: \n Laptop \n \n\n \n You are receiving this email as a notification regarding your employment. \n\n \n\n\n\n \n\n\n\n\n Please do not hesitate to contact us if you have any questions. \n \n ",
"custom_fields": {
"resolution": null
},
"created_at": "2022-08-03T02:08:00Z",
"updated_at": "2022-08-03T04:40:05Z",
"urgency": 1,
"impact": 1,
"category": "HR",
"sub_category": "Onboard",
"item_category": null,
"deleted": false,
"attachments": null
}
}
I’ve been trying to extract the email part “user.name@xxxx.com” as a string in either the
“description_text” string or “description” string to then be able to send an email to that email address we extract.
The email will be variable and change depending on the Hiring Manager so it has to capture the email address no matter what the email address is.
Can anybody assist please, this has stumped me.
Thanks
Best answer by RichardR
View original