问题
I'm connecting api of Acumatica. Present, i use AR303000Submit function. but it return error
Error #102: View doesn't exist.
at PX.Data.PXViewCollection.get_Item(String key)
at PX.Api.SyImportProcessor.SyStep.FillSearches(String viewName, SyView view, List`1 srchs, List`1 sorts, List`1 descs)
at PX.Api.SyImportProcessor.SyStep.SelectRows(String viewName, PXFilterRow[] filters, Int32 topCount, Boolean bypassInserted, Int32 startRow, Dictionary`2 externalSorts)
at PX.Api.SyImportProcessor.ExportTableHelper.a(SyStep A_0, GrowingTable A_1, SyCommand A_2, PXFilterRow[] A_3, Int32 A_4)
at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()
at PX.Api.ScreenUtils.Submit(String screenId, Command[] commands, SchemaMode schemaMode, PXGraph& graph, String& redirectContainerView, String& redirectScreen, Boolean mobile, Dictionary`2 viewFilters)
at PX.Api.Services.ScreenService.Submit(String id, IEnumerable`1 commands, SchemaMode schemaMode, Boolean mobile, PXGraph& forceGraph, String& redirectContainerView, String& redirectScreen, Dictionary`2 viewFilters)
at PX.Api.Services.ScreenService.Submit(String id, IEnumerable`1 commands, SchemaMode schemaMode)
at PX.Api.Soap.Screen.ScreenGate.Submit(Command[] commands)
--- End of inner exception stack trace ---
I know some question about this object is much but this is old or not update
My code
$AR303000GetSchema = $acumatica->client->AR303000GetSchema(new GetSchema());
$AR303000GetSchema = $AR303000GetSchema->GetSchemaResult;
$acumatica->client->AR303000Clear(new Clear());
$AR303000Submit = new Submit();
$AR303000Submit->commands = array
(
$acumatica->prepareValue("TEST123", $AR303000GetSchema->CustomerSummary->CustomerID),
$acumatica->prepareValue("TEST123", $AR303000GetSchema->CustomerSummary->CustomerName),
$acumatica->prepareValue('US', $AR303000GetSchema->GeneralInfoMainAddress->Country),
$AR303000GetSchema->Actions->Save
);
$submit_result = $acumatica->client->AR303000Submit($AR303000Submit);
Help me. Thanks
Update I try it at http://forum.acumatica.com/forum/acumatica-reseller-and-isv-community/development-and-customization/740-api-how-to-create-api-project-and-use-it-with-c-php-java?q=php (#3)
$schema = $AR303000GetSchema;
$cmds = array();
$cmd = new Value();
$cmd->Value = "giahoang";
$cmd->LinkedCommand = $schema->CustomerSummary->CustomerID;
$soapvar = new \SoapVar($cmd, SOAP_ENC_OBJECT, "Value", "http://www.acumatica.com/typed/");
array_push($cmds, $soapvar);
$cmd = new Value();
$cmd->Value = "giahoang";
$cmd->LinkedCommand = $schema->CustomerSummary->CustomerName;
$soapvar = new \SoapVar($cmd, SOAP_ENC_OBJECT, "Value", "http://www.acumatica.com/typed/");
array_push($cmds, $soapvar);
$cmd = new Value();
$cmd->Value = "US";
$cmd->LinkedCommand = $schema->GeneralInfoMainAddress->Country;
$soapvar = new \SoapVar($cmd, SOAP_ENC_OBJECT, "Value", "http://www.acumatica.com/typed/");
array_push($cmds, $soapvar);
$cmd = new Value();
$cmd->Value = "hoang@acumatica.com";
$cmd->LinkedCommand = $schema->GeneralInfoMainContact->Email;
$soapvar = new \SoapVar($cmd, SOAP_ENC_OBJECT, "Value", "http://www.acumatica.com/typed/");
array_push($cmds, $soapvar);
$soapvar = new \SoapVar($schema->Actions->Save, SOAP_ENC_OBJECT, "Action", "http://www.acumatica.com/typed/");
array_push($cmds, $soapvar);
$submit_result = $acumatica->client->AR303000Submit(array(array("commands" => $cmds)));
print_r($submit_result);
return error
System.Web.Services.Protocols.SoapException: Server was unable to process request. --->
System.ArgumentNullException: Value cannot be null.\nParameter name: source\n
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\n
at PX.Api.Soap.Screen.ScreenGate.Submit(Command[] commands)\n
--- End of inner exception stack trace ---
I don't know i was misstake. PS: I try C#, it ok
回答1:
It's general error, looks like something wrong with your code.
please follow old article http://forum.acumatica.com/forum/acumatica-reseller-and-isv-community/development-and-customization/740-api-how-to-create-api-project-and-use-it-with-c-php-java?q=php
also you can take a look general help and info from Acumatica Univeristy there is training quide.
来源:https://stackoverflow.com/questions/33664742/error-ar303000submit-use-php-api-acumatica-erp