Inbound action script help for stripping only computer name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 10:16 AM
Hello I need to create an Incident when an Email from xyz is being sent to servicenow , but email might have some computer names which I need to only get those names and set it in Description of Incident ,
Below is the email which we will get and we only want computer names under Problematic BCA clients .
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 01:48 PM
@RudhraKAM You can build regex here and use match() to retrieve the computer name data.
Doc link for further details.
Thanks
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 06:19 PM
What's the HTML structure behind the email and aside from the count of computer names that might appear is the structure consistent?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2025 12:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
(function executeRule(current, previous) {
// 1. Define the property name
var propertyName = 'wf.change.success.score.icon.visibility';
// 2. Get the comma-separated list of roles from the property
var requiredRoles = gs.getProperty(propertyName);
// 3. Set the default visibility to false
g_scratchpad.showButton = 'false';
// 4. Check if the property has a value (roles specified)
if (requiredRoles) {
// 5. Check if the current user has ANY of the required roles
// gs.hasRole() can take a comma-separated string of roles.
if (gs.hasRole(requiredRoles)) {
g_scratchpad.showButton = 'true';
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
<g2:evaluate var="jvar_disable_click" jelly="true">
// ... (Keep existing variable declarations) ...
var isNewRecord = current.isNewRecord();
var isActiveRecord = current.active;
var flag = true;
var disableClick = false;
var hideSpan = "";
var cr_type = current.type;
// ... (Keep existing URL properties) ...
// Check change type
if(cr_type == 'normal' || cr_type == 'expedited' || cr_type == 'emergency') {
flag = true;
} else {
flag = false;
}
// -------------------------------------------------------------------
// **CORRECTED ROLE CHECKING LOGIC**
// -------------------------------------------------------------------
var rolesProperty = gs.getProperty('wf.change.success.score.icon.visibility');
var hasRequiredRole = false; // Default to false until a role is confirmed
if (rolesProperty) {
// Use gs.hasRole() directly with the comma-separated string from the property.
// gs.hasRole() efficiently checks if the current user has ANY role in the list.
if (gs.hasRole(rolesProperty)) {
hasRequiredRole = true;
}
} else {
// If the property is empty, assume button should be hidden (or visible, depending on requirement)
// I will assume if the property is empty, the button is hidden for safety.
hasRequiredRole = false;
}
// If the user does NOT have the required role, set flag to false
if (!hasRequiredRole) {
flag = false;
}
// -------------------------------------------------------------------
if (isNewRecord || !isActiveRecord || !flag) {
disableClick = true;
hideSpan = "hidden";
}
disableClick;
</g2:evaluate>
