diff --git a/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v1/ScriptF.scala b/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v1/ScriptF.scala index 443974e17365..266a901599fb 100644 --- a/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v1/ScriptF.scala +++ b/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v1/ScriptF.scala @@ -545,10 +545,17 @@ object ScriptF { for { client <- Converter.toFuture(env.clients.getParticipant(participant)) user <- client.getUser(userId) - user <- Converter.toFuture( + userValue <- Converter.toFuture( Converter.fromOptional(user, Converter.fromUser(env.scriptIds, _)) ) - } yield SEAppAtomic(SEValue(continue), Array(SEValue(user))) + } yield { + (participant, user.flatMap(_.primaryParty)) match { + case (Some(participant), Some(party)) => + env.addPartyParticipantMapping(party, participant) + case _ => + } + SEAppAtomic(SEValue(continue), Array(SEValue(userValue))) + } } final case class DeleteUser( diff --git a/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ScriptF.scala b/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ScriptF.scala index d5488a61a3e0..ecdf2bf277f2 100644 --- a/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ScriptF.scala +++ b/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ScriptF.scala @@ -626,10 +626,17 @@ object ScriptF { for { client <- Converter.toFuture(env.clients.getParticipant(participant)) user <- client.getUser(userId) - user <- Converter.toFuture( + userValue <- Converter.toFuture( Converter.fromOptional(user, Converter.fromUser(env.scriptIds, _)) ) - } yield SEValue(user) + } yield { + (participant, user.flatMap(_.primaryParty)) match { + case (Some(participant), Some(party)) => + env.addPartyParticipantMapping(party, participant) + case _ => + } + SEValue(userValue) + } } final case class DeleteUser(