getting the order uuid or id after creation

Hi everyone,

i am trying to do some modifications on the OrderEntryUI module and for some complex reasons i need to get the uuid or the id of the order created directly after form submission.

The HTTP response to your POST should be the default representation of the created object, which has the UUID.

1 Like

where can i get the post response on the OrderEntryUI code is it in this method ?

            var saved = Encounter.save(encounter);
            saved.$promise.then(function(encounter) {
                $rootScope.$broadcast("visit-changed", encounter.visit);
                // here ? 
            });

This module creates the orders in a batch by posting to the encounter REST endpoint.

In this case all of the newly-created orders will be in the encounter object. (If you’ve created multiple orders and want to find a specific one then you’ll have to inspect it in some way, e.g. by concept.)

thanks found it its in the file drugOrders.js

        OrderEntryService.signAndSave({ draftOrders: $scope.draftDrugOrders, hhkFrequency: $scope.hhkFrequency}, encounterContext)
            .$promise.then(function(result) {
             // right here : the result object contains everything..
            location.href = location.href;
        }, function(errorResponse) {
            emr.errorMessage(errorResponse.data.error.message);
            $scope.loading = false;
        });