Bob320 Posted August 19, 2016 Share Posted August 19, 2016 I'm trying to carry out a simple asset update of a Computer Peripheral and it's proven quite hard work. I only want to change the "location" of the asset. In order to achieve success I couldn't just submit the "required" fields as the FlowCode refused to validate the data that must already be part of the record. So I have had to populate all kinds of other fields to get it to work. Required fields are: assetId, name, type, version But I actually had to fill in all of these. $peripheral = [ 'acqMethod' => 1, 'actualRetireDate' => '1970-01-01 00:00:00', 'assetId' => 3533, 'cost' => 0, 'deprecMethod' => 0, 'deprecStart' => '1970-01-01 00:00:00', 'deprecValue' => 0, 'disposalPrice' => 0, 'location' => 'Bedroom', 'locationType' => 0, 'maintenanceCost' => 0, 'maintenanceRef' => '', 'name' => 'CBC8522', 'operationalState' => 0, 'orderDate' => '1970-01-01 00:00:00', 'receivedDate' => '1970-01-01 00:00:00', 'residualValue' => 0, 'scheduledRetireDate' => '1970-01-01 00:00:00', 'siteId' => 1, 'sourceImage' => '', 'state' => 0, 'type' => 8, //'Monitor', 'version' => 0, 'warrantyExpires' => '1970-01-01 00:00:00', 'warrantyStart' => '1970-01-01 00:00:00', 'wireless' => '' ]; Which produces the XML: <methodCall service="apps/com.hornbill.servicemanager/AssetsComputerPeripheral" method="updateAssetComputerPeripheral"><params> <acqMethod>1</acqMethod> <actualRetireDate>1970-01-01 00:00:00</actualRetireDate> <assetId>3533</assetId> <cost>0</cost> <deprecMethod>0</deprecMethod> <deprecStart>1970-01-01 00:00:00</deprecStart> <deprecValue>0</deprecValue> <disposalPrice>0</disposalPrice> <location>Bedroom</location> <locationType>0</locationType> <maintenanceCost>0</maintenanceCost> <maintenanceRef></maintenanceRef> <name>CBC8522</name> <operationalState>0</operationalState> <orderDate>1970-01-01 00:00:00</orderDate> <receivedDate>1970-01-01 00:00:00</receivedDate> <residualValue>0</residualValue> <scheduledRetireDate>1970-01-01 00:00:00</scheduledRetireDate> <siteId>1</siteId> <sourceImage></sourceImage> <state>0</state> <type>8</type> <version>0</version> <warrantyExpires>1970-01-01 00:00:00</warrantyExpires> <warrantyStart>1970-01-01 00:00:00</warrantyStart> <wireless></wireless> </params></methodCall> I can understand the validation reasoning, but it would seem that all this is bypassed during the asset import process, which is probably going to leave a minefield for later. My only recourse would be to search for the asset, retrieve all the current values, validate them locally and populate them where necessary, then resubmit the data just to update the one field I want to update. If the fields aren't set as mandatory surely the flowcode shouldn't be acting like this? Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now