Topic by Shreyas Pandhari
Content
Hi,
I am trying to access and set the custom field value in apply() as well as TestHarness() methods but process designer throws an error. I even tried with the way given in Oracle document but still no luck.
1. I tried with simple $object->CustomFields->c->field_name = 'xyz';
2. I am getting no clear understanding from the Snippet (below) in document
http://documentation.custhelp.com/euf/assets/devdocs/february2014/Connect_PHP/Default.htm.
Do we need to write metadata code for each custom field if I have n number of CFs? What is ocs_pid here?
- try{
- $inc=newRNCPHP\Incident;
- $md=$inc::getMetadata();
- $cf_type_name=$md->CustomFields->type_name;
- $md2=$cf_type_name::getMetadata();
- $inc->CustomFields->c=new$md2->c->type_name;
- // must know the name 'ocs_pid' and
- // the data type that goes into it
- $inc->CustomFields->c->ocs_pid="the field";
- // setting required fields for incident
- $cont=RNCPHP\Contact::fetch(123495);
- $inc->PrimaryContact=$cont;
- $inc->save();
- }
- catch(Exception$err){
- echo $err->getMessage();
- }
Any help to sort out this issue would be appreciated.
Thanks,
Shreyas