Could anyone here answer a suitetalk question abou...
# suitetalkapi
k
Could anyone here answer a suitetalk question about pulling custom fields from Cases (SupportCaseIssue class)? [example in reply]
Copy code
$case = new SupportCase();
$case->company = new RecordRef();
$case->company->internalId = "1127"; // Random Company ID
$case->title = "Test Case"; // Case Subject
$case->manufacturer = "Apple"; // Custom Field called "manufacturer" doesn't send also doesnt not error
$request = new AddRequest();
$request->record = $case;

$addResponse = $service->get($request);

if (!$addResponse->writeResponse->status->isSuccess) {
    echo "ADD ERROR";
} else {
    echo "ADD SUCCESS, id" . $addResponse->writeResponse->baseRef->internalId;
}
Is there a way to send custom fields like manufacturer via the class $case or is it a separate record?
e
CustomFieldList is a separate array containing custom fields in a record.
k
Could I add them to a new ticket like $case->CustomFieldList->manufacturer
e
I’m not familiar with PHP so I wouldn’t know how you’d reference that
This is what it looks like in C# if (itemRow.basic.customFieldList.Length >= 1) { for (int x = 0; x <= itemRow.basic.customFieldList.Length - 1; x++) { if (itemRow.basic.customFieldList[x].GetType() == typeof(SearchColumnStringCustomField)) { var customStringField = (SearchColumnStringCustomField)itemRow.basic.customFieldList[x]; switch (customStringField.scriptId) { case “custitem_oc_fake_stock”: if (!string.IsNullOrEmpty(customStringField.searchValue)) { mFakeStock = Convert.ToInt32(customStringField.searchValue.ToString()); } else { mFakeStock = 0; } break; case “custitem_oc_asin”: if (!string.IsNullOrEmpty(customStringField.searchValue)) { mASIN = customStringField.searchValue; } else { mASIN = string.Empty; }break; } }
when you loop through the array you would need to determine the field type of the custom field (itemRow.basic.customFieldList[x].GetType() == typeof(SearchColumnStringCustomField))
k
Yea definitely reads differently in php but I figured it out, thanks for setting me down the right path.
👍 1