And if there is any chance of the code trying to assign a context which does not yet exist in the database, you may also need to add a line to create that context on the wing.
Sth like:
Code:
tell application "OmniFocus"
tell front document
set mytask to first item of (parse tasks with transport text "test item > Miscellaneous @Home")
set lstContexts to flattened contexts where name is "Office"
if length of lstContexts > 0 then
set context of mytask to first item of lstContexts
else
set context of mytask to (make new context with properties {name:"Office"})
end if
end tell
end tell