Mod note: As of SDK 1.5.0 Scenarios have been superseded by the more powerful Daml Script. We now recommend using that for all purposes. For more information, and to learn how to use Script please check out @Andreas’ post on our blog.
Here is my code
template Attandance
with
systemUser : Party
associate : Optional Party
punchInTime : Optional Time
punchOutTime :Optional Time
where
signatory systemUser
nonconsuming choice PunchIn
: ContractId Attandance
with
currentTime : Time
controller associate
do
create this with punchInTime = Some currentTime
nonconsuming choice PunchOut
: ContractId Attandance
with
currentTime : Time
controller associate
do
create this with punchOutTime = Some currentTime
Here is my scenario of update punchIn
setup = do
systemUser <- getParty "Alice"
associate <- getParty "Bob"
atid <- submit systemUser do
create Attandance
with
systemUser
associate = None
punchInTime = None
punchOutTime = None
submit associate do
exercise asid PunchIn with
currentTime <- getTime
return()
Attempt to fetch or exercise a contract not visible to the committer.
** Contract: #2:0 (Attendence:Attandance)**
** Committer: 'Bob**
** Disclosed to: 'Alice**
I know why this error occur because systemUser create Attendance and associate exercise the choice but systemUser has to create attendance and associate PunchIn or PunchOut, I make “associate” observer, but it not solved.