Topic by Richard Morgan
Content
I am creating a custom process module (CPM) on the update of an opportunity. It should take the assigned account's email address and populate a custom field on the opportunity.
In the code, the test harness passes.
Two issues after much debugging:
1) $opportunity->AssignedToAccount is null. Why is that?
In an attempt to workaround, I thought I would use ROQL, but I don't see how to get the email address from the Account object.
2) Setting the custom field does not work. At one point, I was hard-coding the value:
$opportunity->CustomFields->c->assigned_email = "foo@foo.com";
(Assigned email is a text of Email type.)
I even tried using the sample code where a new CustomFields object is created:
$opp = new RNCPHP\Opportunity;$md = $opp::getMetadata();$cf_type_name = $md->CustomFields->type_name;$md2 = $cf_type_name::getMetadata();$opportunity->CustomFields->c = new $md2->c->type_name;
Any help or advice is appreciated.