Sunday, February 26, 2023

Profile options validation script

 #!/bin/bash


# Source the R12.2 application environment file

. /path/to/R12.2/envfile


# Specify profile option name and expected value

PROFILE_OPTION_NAME="EXAMPLE_PROFILE_OPTION"

EXPECTED_VALUE="EXPECTED_VALUE"


# Set email addresses and subject for report

EMAIL_RECIPIENT="youremail@example.com"

EMAIL_SUBJECT="Profile Option Validation Report"


# Set report file name and path

REPORT_FILE_NAME="profile_option_report.html"

REPORT_FILE_PATH="/path/to/report/directory/$REPORT_FILE_NAME"


# Get current value of profile option

CURRENT_VALUE=$(sqlplus -s username/password << EOF

set heading off feedback off verify off

select PROFILE_OPTION_VALUE from FND_PROFILE_OPTION_VALUES where PROFILE_OPTION_NAME='$PROFILE_OPTION_NAME';

exit;

EOF

)


# Check if the value matches the expected value

if [[ "$CURRENT_VALUE" == "$EXPECTED_VALUE" ]]; then

  # Value is correct

  MESSAGE="Profile option '$PROFILE_OPTION_NAME' has the expected value '$EXPECTED_VALUE'"

  COLOR="green"

else

  # Value is incorrect

  MESSAGE="Profile option '$PROFILE_OPTION_NAME' has an incorrect value. Expected '$EXPECTED_VALUE', but found '$CURRENT_VALUE'"

  COLOR="red"

fi


# Create HTML report

echo "<html><body><h2>$MESSAGE</h2></body></html>" > "$REPORT_FILE_PATH"


# Add CSS style to report based on color

echo "<style>h2 {color: $COLOR;}</style>" >> "$REPORT_FILE_PATH"


# Send report via email

mailx -a "Content-Type: text/html" -s "$EMAIL_SUBJECT" "$EMAIL_RECIPIENT" < "$REPORT_FILE_PATH"


No comments:

Post a Comment