Email Field ID instead of Lookup

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
super20g
User
Posts: 49

Email Field ID instead of Lookup

Post by super20g »

Hello, Some of the fields that are being sent in emails such as when a record is added or deleted shows the ID rather than the lookup value.

i.e. 'Provider: 12' instead of 'Provider: MyProviderNameHere'.

So using:

$Email->Content .= "\nProvider:\t" . $Args["rsnew"]["provider_info_ID"];

Gives me 12.

I have tried multiple iterations such as:

$Email->Content = str_replace("\nProvider:\t" . $Args["rsnew"]["provider_info_ID"], "\nProvider:\t" . ew_ExecuteScalar("SELECT provider_name FROM provider_info WHERE ID ='" . $rsnew["provider_info_ID"] . "'"), $Email->Content);

But I can't seem to get it just right. This seems like this would be a common occurrence, could anyone show me how to accomplish this task?


mobhar
User
Posts: 11745

Post by mobhar »

Try this:

$Email->Content = str_replace("\nProvider:\t" . $Args["rsnew"]["provider_info_ID"], "\nProvider:\t" . ew_ExecuteScalar("SELECT provider_name FROM provider_info WHERE ID ='" . $Args["rsnew"]["provider_info_ID"] . "'"), $Email->Content);


super20g
User
Posts: 49

Post by super20g »

Thanks, that did the trick!

So my finished solution is:

$Email->Content .= "\nProvider:\t" . $Args["rsnew"]["provider_info_ID"];
$Email->Content = str_replace("\nProvider:\t" . $Args["rsnew"]["provider_info_ID"], "\nProvider:\t" . ew_ExecuteScalar("SELECT provider_name FROM provider_info WHERE ID ='" . $Args["rsnew"]["provider_info_ID"] . "'"), $Email->Content);

In order to swap the ID with a lookup value. Anything but elegant, but it works... If anyone comes across a more proper solution, please feel free to post it.


Post Reply