web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem reading Output...
Power Apps
Unanswered

Problem reading OutputParameters from stored procedures

(0) ShareShare
ReportReport
Posted on by 37
Hi!

I have created an stored procedure:
 
ALTER PROCEDURE [dbo].[sp_RegistrarAccesoSocioEvento]
    @IdPersona INT,
    @IdEvento INT,
    @Puerta INT,
    @Resultado INT OUTPUT
AS
BEGIN
    SET @Result = 0 
    
    BEGIN TRY
        INSERT INTO CONTROLACCESOEVENTOS_REGISTROACCESOSSOCIOS
        VALUES (@IdPersona, @IdEvento, GETDATE(), @Puerta);
    END TRY
    BEGIN CATCH
        -- Error Manage
        IF ERROR_NUMBER() = 2627 -- Unique value violation
        BEGIN
            SET @Result = -2 -- IdPersona exists
            RETURN;
        END
        ELSE
        BEGIN
            SET @Result = -1; -- Any other error
            THROW;
        END
    END CATCH
END

I launch the stored procedure with:
 
            UpdateContext({
                ResultadoRegistroSocio:
                sp_SocioEventos.dbospRegistrarAccesoSocioEvento({
                    IdPersona: AccesosSociosClub_SelectedRecord.IdPersona;
                    IdEvento: dropdwn_SeleccionaEvento.Selected.Evento;
                    Puerta: dropdwn_SeleccionaPuerta.Selected.CodigoPuerta
                })
            });;
 
The stored procedure is correctly executed, but I can't read the 'Reusult' output parameter
 
            UpdateContext({
                varResultadoProcedimientoAlmacenado:
                Value(ResultadoRegistroSocio.OutputParameters.Result)
            });;
 
It returns... nothing!
 
When I inspect the variables:

 
It looks like the types are not recognized
 
Can you help me, please?
 
NOTE: I Know for this I should use ReturnCode, but this is just an example. Anyway, ReturnCode also does not work
 
 
Categories:
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at
    When you call a stored procedure from Power Apps directly one of the problems is that any output is returned as a JSON string without any schema. So the Result is there, but it is untyped.  You'll need to cast the result to an integer to use it.
     
    Int(ResultadoRegistroSocio.OutputParameters.Result)

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard