For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
I'm using the following code to try to pull all the product IDs for a given answer. If I run the code in a CP page, it works. If I run it in a custom process, it returns null values. (Similar behavior for Categories)
In CP page, it pulls the answer via $answer = RNCPHP\Answer::fetch($aid,RNCPHP\RNObject::VALIDATE_KEYS_OFF);
In Custom Process, it runs on the answer update event.
NOTE: All other answer fields I try to access so far seem to work. It is just the product and category fields that refuse to show up in a Custom Process.
What am I missing?
Hi,
Please fetch the product and category of answer with ROQL query().
Replace your code with following code in CPM:
$roql_result = RNCPHP\ROQL::query( "SELECT A.Products.ID,A.Products.LookupName from Answer A where A.ID=".$obj->ID )->next();
$i=0;
while($answer = $roql_result->next())
{
$products[$i]['ID'] = $answer['ID'];
$products[$i]['LookupName'] = $answer['LookupName'];
$i++;
}
NOTE: In the CPM some fields are not Fetch directly by $obj.
eg. Custom Fields of any object can't be fetch through $obj But with ROQL query() we can easily fetch custom field.
Thanks,
Gurinderpal
Thanks. I'll try ROQL.
The weird thing is there is no rhyme or reason to which will work and which will not. For instance, some custom fields work just fine for me. Even a custom object works fine. But this standard field does not. /shrug
EDIT: Got this working last night. The ROQL stuff is working like a charm. Thanks!
Josh
Hi,
Please fetch the product and category of answer with ROQL query().
Replace your code with following code in CPM:
$roql_result = RNCPHP\ROQL::query( "SELECT A.Products.ID,A.Products.LookupName from Answer A where A.ID=".$obj->ID )->next();
$i=0;
while($answer = $roql_result->next())
{
$products[$i]['ID'] = $answer['ID'];
$products[$i]['LookupName'] = $answer['LookupName'];
$i++;
}
NOTE: In the CPM some fields are not Fetch directly by $obj.
eg. Custom Fields of any object can't be fetch through $obj But with ROQL query() we can easily fetch custom field.
Thanks,
Gurinderpal